private void Visit(NUnit.Framework.Api.ITestResult result) { if (result.Test is TestSuite) { foreach (NUnit.Framework.Api.ITestResult child in result.Children) { Visit(child); } return; } testCount++; switch (result.ResultState.Status) { case TestStatus.Skipped: notRunCount++; break; case TestStatus.Failed: if (result.ResultState == ResultState.Failure) { failureCount++; } else { errorCount++; } break; case TestStatus.Passed: break; } }
private void PrintAllResults(NUnit.Framework.Api.ITestResult result, string indent) { string value = null; switch (result.ResultState.Status) { case TestStatus.Failed: value = "FAIL"; break; case TestStatus.Skipped: value = "SKIP"; break; case TestStatus.Inconclusive: value = "INC "; break; case TestStatus.Passed: value = "OK "; break; } writer.Write(value); writer.Write(indent); writer.WriteLine(result.Name); if (!result.HasChildren) { return; } foreach (NUnit.Framework.Api.ITestResult child in result.Children) { PrintAllResults(child, indent + " "); } }
private void PrintErrorReport(NUnit.Framework.Api.ITestResult result) { reportCount = 0; writer.WriteLine(); writer.WriteLine("Errors and Failures:"); PrintErrorResults(result); }
private void PrintNotRunReport(NUnit.Framework.Api.ITestResult result) { reportCount = 0; writer.WriteLine(); writer.WriteLine("Tests Not Run:"); PrintNotRunResults(result); }
private void ReportResults(NUnit.Framework.Api.ITestResult result) { Summary = new ResultSummary(result); writer.WriteLine("{0} Tests : {1} Failures, {2} Errors, {3} Not Run", Summary.TestCount, Summary.FailureCount, Summary.ErrorCount, Summary.NotRunCount); if (Summary.FailureCount > 0 || Summary.ErrorCount > 0) { PrintErrorReport(result); } if (Summary.NotRunCount > 0) { PrintNotRunReport(result); } }
private void RunTests() { NUnit.Framework.Api.ITestResult testResult = runner.Run(TestListener.NULL, TestFilter.Empty); ReportResults(testResult); string resultFile = commandLineOptions.ResultFile; if (resultFile != null) { XmlTextWriter xmlTextWriter = new XmlTextWriter(resultFile, Encoding.UTF8); xmlTextWriter.Formatting = Formatting.Indented; testResult.ToXml(recursive: true).WriteTo(xmlTextWriter); xmlTextWriter.Close(); } }
public void AddResult(NUnit.Framework.Api.ITestResult result) { if (children == null) { children = new List <NUnit.Framework.Api.ITestResult>(); } children.Add(result); TestStatus status = result.ResultState.Status; if (status == TestStatus.Failed) { SetResult(ResultState.Failure, "Component test failure"); } }
private void PrintNotRunResults(NUnit.Framework.Api.ITestResult result) { if (result.HasChildren) { foreach (NUnit.Framework.Api.ITestResult child in result.Children) { PrintNotRunResults(child); } } else if (result.ResultState == ResultState.Ignored || result.ResultState == ResultState.NotRunnable || result.ResultState == ResultState.Skipped) { writer.WriteLine(); writer.WriteLine("{0}) {1} ({2}) : {3}", ++reportCount, result.Name, result.FullName, result.Message); } }
private void PrintErrorResults(NUnit.Framework.Api.ITestResult result) { if (result.HasChildren) { foreach (NUnit.Framework.Api.ITestResult child in result.Children) { PrintErrorResults(child); } } else if (result.ResultState == ResultState.Error || result.ResultState == ResultState.Failure) { writer.WriteLine(); writer.WriteLine("{0}) {1} ({2})", ++reportCount, result.Name, result.FullName); writer.WriteLine(result.Message); writer.WriteLine(result.StackTrace); } }
private void ReportResults(NUnit.Framework.Api.ITestResult result) { ResultSummary resultSummary = new ResultSummary(result); writer.WriteLine("{0} Tests : {1} Failures, {2} Errors, {3} Not Run", resultSummary.TestCount, resultSummary.FailureCount, resultSummary.ErrorCount, resultSummary.NotRunCount); if (resultSummary.FailureCount > 0 || resultSummary.ErrorCount > 0) { PrintErrorReport(result); } if (resultSummary.NotRunCount > 0) { PrintNotRunReport(result); } if (commandLineOptions.Full) { PrintFullReport(result); } }
public ResultSummary(NUnit.Framework.Api.ITestResult result) { Visit(result); }
private void PrintFullReport(NUnit.Framework.Api.ITestResult result) { writer.WriteLine(); writer.WriteLine("All Test Results:"); PrintAllResults(result, " "); }
public void TestFinished(NUnit.Framework.Api.ITestResult result) { }
private void RunTests() { NUnit.Framework.Api.ITestResult result = runner.Run(TestListener.NULL, TestFilter.Empty); ReportResults(result); }