リポジトリ
使用例
using Kogane;
using UnityEditor;
using UnityEditor.TestTools.TestRunner.Api;
using UnityEngine;
public class Example
{
[MenuItem( "Tools/Hoge" )]
private static void Hoge()
{
var callback = new TestRunnerApiCallbacks
{
OnRunStarted = testsToRun => Debug.Log( testsToRun.Name ),
OnTestStarted = test => Debug.Log( test.Name ),
OnTestFinished = result => Debug.Log( result.TestStatus ),
OnRunFinished = result => Debug.Log( result.TestStatus ),
};
var testRunnerApi = ScriptableObject.CreateInstance<TestRunnerApi>();
testRunnerApi.RegisterCallbacks( callback );
var filter = new Filter
{
testMode = TestMode.EditMode,
};
testRunnerApi.Execute( new ExecutionSettings( filter ) );
testRunnerApi.UnregisterCallbacks( callback );
}
}