protected override bool Visit(ITestFailed testFailed) { var testCase = testCases.Single(tc => tc.DisplayName == testFailed.TestCase.DisplayName); testCase.State = TestState.Failed; var resultString = new StringBuilder(testFailed.TestCase.DisplayName); resultString.AppendLine(" FAILED:"); for (int i = 0; i < testFailed.ExceptionTypes.Length; i++) { resultString.AppendLine($"\tException type: '{testFailed.ExceptionTypes[i]}', number: '{i}', parent: '{testFailed.ExceptionParentIndices[i]}'"); resultString.AppendLine($"\tException message:"); resultString.AppendLine(testFailed.Messages[i]); resultString.AppendLine($"\tException stacktrace"); resultString.AppendLine(testFailed.StackTraces[i]); } resultString.AppendLine(); TestFinished?.Invoke(this, TestStateEventArgs.Failed(resultString.ToString())); return(!isCancelRequested()); }
private void TestRunVisitor_TestFinished(object sender, TestStateEventArgs e) { TestsCompleted++; switch (e.State) { case TestState.Passed: TestsPassed++; break; case TestState.Failed: TestsFailed++; Output = Output + e.Results; break; case TestState.Skipped: TestsSkipped++; break; } if (e.State > CurrentRunState) { CurrentRunState = e.State; } }