リポジトリ
使用例
using Kogane;
using UnityEditor;
using UnityEditor.TestTools.TestRunner.Api;
using UnityEngine;
public class Callbacks : ICallbacks
{
public void TestStarted( ITestAdaptor test )
{
Debug.Log( new JsonITestAdaptor( test ) );
}
public void RunStarted( ITestAdaptor testsToRun )
{
Debug.Log( new JsonITestAdaptor( testsToRun ) );
}
public void RunFinished( ITestResultAdaptor result )
{
Debug.Log( new JsonITestResultAdaptor( result ) );
}
public void TestFinished( ITestResultAdaptor result )
{
Debug.Log( new JsonITestResultAdaptor( result ) );
}
}
public class Example
{
[MenuItem( "Tools/Hoge" )]
private static void Hoge()
{
var callback = new Callbacks();
var testRunnerApi = ScriptableObject.CreateInstance<TestRunnerApi>();
testRunnerApi.RegisterCallbacks( callback );
var filter = new Filter
{
testMode = TestMode.EditMode,
};
testRunnerApi.Execute( new ExecutionSettings( filter ) );
testRunnerApi.UnregisterCallbacks( callback );
}
}