public void TestFinished(TestResult result) { switch (result.ResultState) { case ResultState.Error: { testInfo.Status = ReporterTestInfo.TestStatus.error; report.Report(result.Message, result.StackTrace, ReporterTestInfo.TestStatus.error); break; } case ResultState.Success: { testInfo.Status = ReporterTestInfo.TestStatus.success; break; } case ResultState.Failure: { testInfo.Status = ReporterTestInfo.TestStatus.failure; report.Report(result.Message, result.StackTrace, ReporterTestInfo.TestStatus.failure); break; } default: { testInfo.Status = ReporterTestInfo.TestStatus.warning; break; } } testStopwatch.Stop(); testInfo.DurationTime = testStopwatch.ElapsedMilliseconds; report.EndTest(testInfo); }
public void AfterAll() { TestContext.ResultAdapter resultAdapter = TestContext.CurrentContext.Result; if (resultAdapter.Outcome == ResultState.Success && (testInfo.Status == DifidoTestStatus.failure || testInfo.Status == DifidoTestStatus.error)) { testStopwatch.Stop(); testInfo.DurationTime = testStopwatch.ElapsedMilliseconds; report.EndTest(testInfo); Assert.Fail("Test failed. See reports above for details."); } if (resultAdapter.Outcome == ResultState.Success) { testInfo.Status = DifidoTestStatus.success; } else if (resultAdapter.Outcome == ResultState.Error) { testInfo.Status = DifidoTestStatus.error; report.Report(resultAdapter.Message, resultAdapter.StackTrace, DifidoTestStatus.error); } else if (resultAdapter.Outcome == ResultState.Failure) { testInfo.Status = DifidoTestStatus.failure; report.Report(resultAdapter.Message, resultAdapter.StackTrace, DifidoTestStatus.failure); } else { testInfo.Status = DifidoTestStatus.warning; } testStopwatch.Stop(); testInfo.DurationTime = testStopwatch.ElapsedMilliseconds; report.EndTest(testInfo); }