public static void CheckForAndRunTest() { string TestName = Environment.GetEnvironmentVariable(MonsterTestCore.MonsterStarterTestNameEnvVariable); // MonsterDebug.Log("Checking for test " + TestName); if (TestName != null && TestName != "" && (TestRunnerInst == null || TestName != CurrentTestName)) { if (TestRunnerInst == null) { TestRunnerInst = new MonsterTestRunner(); } TestRunnerInst.PreloadTest(TestName); TestRunnerInst.StartTest(TestName); MonsterDebug.Log("Starting test " + TestName); CurrentTestName = TestName; } if (TestRunnerInst != null && TestRunnerInst.RunTests()) { MonsterDebug.Log("Finished running test " + TestName); Application.Quit(); } }
public virtual bool RunTest(string TestName) { if (bWasTestRunningInEditor && !EditorApplication.isPlaying && TestRunnerInst != null && TestRunnerInst.CurrentTest != null && TestRunnerInst.CurrentTest.bStartGameInEditor) { if (InternalCleanupTestable(true)) { bWasTestRunningInEditor = false; return(true); } return(false); } if (MonsterStarter.GetInstance(false) == null || TestRunnerInst == null) { if (TestRunnerInst == null) { TestRunnerInst = new MonsterTestRunner(); TestRunnerInst.PreloadTest(TestName); } if (TestRunnerInst.CurrentTest != null && TestRunnerInst.CurrentTest.bAllowRunningInEditor && !InternalBuildTestable(true)) { return(false); } if (TestRunnerInst.CurrentTest != null && TestRunnerInst.CurrentTest.bStartGameInEditor) { EditorApplication.isPlaying = true; bWasTestRunningInEditor = true; if (MonsterStarter.GetInstance(false) == null) { return(false); } } TestRunnerInst.StartTest(TestName); } if (TestRunnerInst.RunTests()) { return(TestRunnerInst.CurrentTest == null || !TestRunnerInst.CurrentTest.bAllowRunningInEditor || InternalCleanupTestable(true)); } return(false); }