public IEnumerator StateMachine() { TestRunnerCallback.RunStarted(Application.platform.ToString(), testToRun); while (true) { if (testToRunQueue.Count == 0 && currentTest == null) { FinishTestRun(); break; } if (currentTest == null) { StartNewTest(); } if (currentTest != null) { if (testState == TestState.Running) { if (assertionsToCheck != null && assertionsToCheck.All(a => a.checksPerformed > 0)) { IntegrationTest.Pass(currentTest.go); testState = TestState.Success; } if (currentTest != null && Time.time > startTime + currentTest.TestComponent.timeout) { testState = TestState.Timeout; } } switch (testState) { case TestState.Success: LogMessage(finishedMessage); FinishTest(TestResult.ResultType.Success); break; case TestState.Failure: LogMessage(failedMessage); FinishTest(TestResult.ResultType.Failed); break; case TestState.Exception: LogMessage(failedExceptionMessage); FinishTest(TestResult.ResultType.FailedException); break; case TestState.Timeout: LogMessage(timeoutMessage); FinishTest(TestResult.ResultType.Timeout); break; case TestState.Ignored: LogMessage(ignoredMessage); FinishTest(TestResult.ResultType.Ignored); break; } } yield return(null); } }
public IEnumerator StateMachine() { TestRunnerCallback.RunStarted(Application.platform.ToString(), m_TestComponents); while (true) { if (!m_TestsProvider.AnyTestsLeft() && currentTest == null) { FinishTestRun(); yield break; } if (currentTest == null) { StartNewTest(); } if (currentTest != null) { if (m_TestState == TestState.Running) { if (m_AssertionsToCheck != null && m_AssertionsToCheck.All(a => a.checksPerformed > 0)) { IntegrationTest.Pass(currentTest.gameObject); m_TestState = TestState.Success; } if (currentTest != null && Time.time > m_StartTime + currentTest.GetTimeout()) { m_TestState = TestState.Timeout; } } switch (m_TestState) { case TestState.Success: LogMessage(k_FinishedMessage); FinishTest(TestResult.ResultType.Success); break; case TestState.Failure: LogMessage(k_FailedMessage); FinishTest(TestResult.ResultType.Failed); break; case TestState.Exception: LogMessage(k_FailedExceptionMessage); FinishTest(TestResult.ResultType.FailedException); break; case TestState.Timeout: LogMessage(k_TimeoutMessage); FinishTest(TestResult.ResultType.Timeout); break; case TestState.Ignored: LogMessage(k_IgnoredMessage); FinishTest(TestResult.ResultType.Ignored); break; } } yield return(null); } }
public IEnumerator StateMachine() { TestRunnerCallback.RunStarted(Application.platform.ToString(), m_TestComponents); while (m_TestsProvider.AnyTestsLeft() || !(currentTest == null)) { if (currentTest == null) { StartNewTest(); } if (currentTest != null) { if (m_TestState == TestState.Running) { if (currentTest.ShouldSucceedOnAssertions()) { AssertionComponent[] source = (from a in currentTest.gameObject.GetComponentsInChildren <AssertionComponent>() where a.enabled select a).ToArray(); if (source.Any() && source.All((AssertionComponent a) => a.checksPerformed > 0)) { IntegrationTest.Pass(currentTest.gameObject); m_TestState = TestState.Success; } } if (currentTest != null && (double)Time.time > m_StartTime + currentTest.GetTimeout()) { m_TestState = TestState.Timeout; } } switch (m_TestState) { case TestState.Success: LogMessage("IntegrationTest Finished"); FinishTest(TestResult.ResultType.Success); break; case TestState.Failure: LogMessage("IntegrationTest Failed"); FinishTest(TestResult.ResultType.Failed); break; case TestState.Exception: LogMessage("IntegrationTest Failed with exception"); FinishTest(TestResult.ResultType.FailedException); break; case TestState.Timeout: LogMessage("IntegrationTest Timeout"); FinishTest(TestResult.ResultType.Timeout); break; case TestState.Ignored: LogMessage("IntegrationTest Ignored"); FinishTest(TestResult.ResultType.Ignored); break; } } yield return(null); } FinishTestRun(); }