in scripts/gha/integration_testing/automated_testapp/AutomatedTestRunner.cs [100:177]
public void Update() {
if (tests == null) {
return;
}
if (!startedExecution) {
LogFunc("Starting executing tests.");
startedExecution = true;
}
if (currentTestIndex >= tests.Length) {
if (Finished) {
// No tests left to run.
// Wait 5 seconds before notifying test lab manager so video can capture end of test.
if (Time.time > endTime + 5f) {
testLabManager.NotifyHarnessTestIsComplete();
}
return;
} else {
// All tests are finished!
LogFunc("All tests finished");
LogFunc(String.Format("PASS: {0}, FAIL: {1}\n\n" +
"{2}{3}", passedTestsCount, failedTestsCount,
failedTestsCount > 0 ? "Failing Tests:\n" : "",
String.Join("\n", failingTestDescriptions.ToArray())));
failingTestDescriptions = new List<string>();
Finished = true;
endTime = Time.time;
}
}
// If the current test is done, start up the next one.
if (!IsRunningTest) {
// Log the results of the test that has finished.
if (CurrentTestResult != null) {
if (CurrentTestResult.IsFaulted) {
LogFunc(String.Format("Test {0} failed!\n\n" +
"Exception message: {1}",
CurrentTestDescription,
CurrentTestResult.Exception.Flatten().ToString()));
++failedTestsCount;
failingTestDescriptions.Add(CurrentTestDescription);
} else if (postTestIgnoredFailureCheckEnabled && testExceptions.Count > 0) {
LogFunc(String.Format("Test {0} failed with {1} exception(s).\n\n",
CurrentTestDescription, testExceptions.Count.ToString()));
for (int i = 0; i < testExceptions.Count; ++i) {
LogFunc(String.Format("Exception message ({0}): {1}\n\n", (i + 1).ToString(),
testExceptions[i].ToString()));
}
++failedTestsCount;
failingTestDescriptions.Add(CurrentTestDescription);
} else {
// If the task was not faulted and no exceptions have been recorded,
// assume it succeeded.
LogFunc("Test " + CurrentTestDescription + " passed.");
++passedTestsCount;
}
} else if (currentTestIndex >= 0 && currentTestIndex < tests.Length &&
tests[currentTestIndex] != null) {
LogFunc(String.Format("Test {0} failed.\n\n" +
"No task was returned by the test.",
CurrentTestDescription));
++failedTestsCount;
failingTestDescriptions.Add(CurrentTestDescription);
}
StartNextTest();
} else {
// Watch out for timeout
float elapsedTime = Time.time - startTime;
if (elapsedTime > TestTimeoutSeconds) {
LogFunc("Test " + CurrentTestDescription + " timed out, elapsed time: " + elapsedTime);
++failedTestsCount;
failingTestDescriptions.Add(CurrentTestDescription);
StartNextTest();
}
}
}