概要
using UnityEditor;
using UnityEditor.TestTools.TestRunner.Api;
using UnityEngine;
internal static class Example
{
[MenuItem( "Tools/Run Play Mode" )]
private static void RunPlayMode()
{
RunTest( TestMode.PlayMode );
}
[MenuItem( "Tools/Run Edit Mode" )]
private static void RunEditMode()
{
RunTest( TestMode.EditMode );
}
private static void RunTest( TestMode testMode )
{
var testRunnerApi = ScriptableObject.CreateInstance<TestRunnerApi>();
var filter = new Filter
{
testMode = testMode,
testNames = null,
groupNames = null,
categoryNames = null,
assemblyNames = null,
targetPlatform = null,
};
testRunnerApi.Execute( new ExecutionSettings( filter ) );
}
}
参考サイト様