public void EndTest(UUnitFinishState finishState, string resultMsg) { EndTime = DateTime.UtcNow; TestResultMsg = resultMsg; FinishState = finishState; ActiveState = UUnitActiveState.READY; }
public void TestComplete(string testName, UUnitFinishState finishState, long stopwatchMs, string message, string stacktrace) { var report = new TestCaseReport { message = message, classname = InternalReport.name, failureText = finishState.ToString(), finishState = finishState, name = testName, time = TimeSpan.FromMilliseconds(stopwatchMs) }; if (InternalReport.testResults == null) { InternalReport.testResults = new List <TestCaseReport>(); } InternalReport.testResults.Add(report); switch (finishState) { case (UUnitFinishState.PASSED): InternalReport.passed += 1; break; case (UUnitFinishState.FAILED): InternalReport.failures += 1; break; case (UUnitFinishState.SKIPPED): InternalReport.skipped += 1; break; } // TODO: Add hooks for SuiteSetUp and SuiteTearDown, so this can be estimated more accurately InternalReport.time = DateTime.UtcNow - InternalReport.timestamp; // For now, update the duration on every test complete - the last one will be essentially correct }
public void AttemptRetry() { ActiveState = UUnitActiveState.PENDING; FinishState = UUnitFinishState.PENDING; TestResultMsg = null; retryCount++; }
public void TestComplete(string testName, UUnitFinishState finishState, long stopwatchMs, string message, string stacktrace) { TestCaseReport report = new TestCaseReport { message = message, classname = InternalReport.name, failureText = finishState.ToString(), finishState = finishState, name = testName, time = TimeSpan.FromMilliseconds(stopwatchMs) }; if (InternalReport.testResults == null) InternalReport.testResults = new List<TestCaseReport>(); InternalReport.testResults.Add(report); switch (finishState) { case (UUnitFinishState.PASSED): InternalReport.passed += 1; break; case (UUnitFinishState.FAILED): InternalReport.failures += 1; break; case (UUnitFinishState.SKIPPED): InternalReport.skipped += 1; break; } // TODO: Add hooks for SuiteSetUp and SuiteTearDown, so this can be estimated more accurately InternalReport.time = DateTime.UtcNow - InternalReport.timestamp; // For now, update the duration on every test complete - the last one will be essentially correct }
public void EndTest(UUnitFinishState finishState, string resultMsg) { if (FinishState == UUnitFinishState.PENDING) { EndTime = DateTime.UtcNow; TestResultMsg = resultMsg; FinishState = finishState; ActiveState = UUnitActiveState.READY; return; } // Otherwise describe the additional end-state and fail the test TestResultMsg += "\n" + FinishState + "->" + finishState + " - Cannot declare test finished twice."; if (finishState == UUnitFinishState.FAILED && FinishState == UUnitFinishState.FAILED) { TestResultMsg += "\nSecond message: " + resultMsg; } FinishState = UUnitFinishState.FAILED; }
void DeleteFiles(UUnitTestContext testContext, List <string> fileName, bool shouldEndTest, UUnitFinishState finishState, string finishMessage) { if (!_shouldDeleteFiles) // Only delete the file if it was created { return; } var request = new DataModels.DeleteFilesRequest { Entity = new DataModels.EntityKey { Id = _entityId, Type = _entityType }, FileNames = fileName, }; _shouldDeleteFiles = false; // We have successfully deleted the file, it should not try again in teardown PlayFabDataAPI.DeleteFiles(request, result => { if (shouldEndTest) { testContext.EndTest(finishState, finishMessage); } }, PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, SharedErrorCallback), testContext); }