private int GetNUnitIgnoredCount(TestExecutionResult testExecutionResult) { return(testExecutionResult.TestResults.Count( r => r.Outcome == "NotExecuted" && (r.ErrorMessage?.Contains("Ignored scenario") == true || r.ErrorMessage?.Contains("Ignored feature") == true))); }
private TestExecutionResult CalculateNUnitTestExecutionResult(TestExecutionResult testExecutionResult) { testExecutionResult.Ignored = GetNUnitIgnoredCount(testExecutionResult); testExecutionResult.Pending = testExecutionResult.Total - testExecutionResult.Executed - testExecutionResult.Ignored; return(testExecutionResult); }
private TestExecutionResult CalculateXUnitTestExecutionResult(TestExecutionResult testExecutionResult) { testExecutionResult.Pending = GetXUnitPendingCount(testExecutionResult.Output); testExecutionResult.Failed -= testExecutionResult.Pending; testExecutionResult.Ignored = testExecutionResult.Total - testExecutionResult.Executed; return(testExecutionResult); }
private TestExecutionResult CalculateXUnitTestExecutionResult(TestExecutionResult testExecutionResult, XDocument trx) { testExecutionResult.Pending = GetXUnitPendingCount(trx.Element(_testRunElementName)?.Element(_resultsElementName)); testExecutionResult.Failed -= testExecutionResult.Pending; testExecutionResult.Ignored = testExecutionResult.Total - testExecutionResult.Executed; return(testExecutionResult); }
private TestExecutionResult CalculateMsTestTestExecutionResult(TestExecutionResult testExecutionResult) { bool HasPendingError(TestResult r) => r.ErrorMessage != null && r.ErrorMessage.Contains("Assert.Inconclusive failed. One or more step definitions are not implemented yet."); testExecutionResult.Ignored = testExecutionResult.TestResults.Count(r => r.Outcome == "NotExecuted" && !HasPendingError(r)); testExecutionResult.Pending = testExecutionResult.TestResults.Count(r => HasPendingError(r)); return(testExecutionResult); }
private int GetNUnitIgnoredCount(TestExecutionResult testExecutionResult) { var elements = from testResult in testExecutionResult.TestResults where testResult.Outcome == "NotExecuted" where testResult.ErrorMessage?.Contains("Scenario ignored using @Ignore tag") == true || testResult.ErrorMessage?.Contains("Ignored feature") == true select testResult; return(elements.Count()); }
private TestExecutionResult CalculateMsTestTestExecutionResult(TestExecutionResult testExecutionResult) { testExecutionResult.Pending = testExecutionResult.TestResults .Where(r => r.ErrorMessage != null) .Select(r => r.ErrorMessage) .Count(m => m.Contains("Assert.Inconclusive failed")); testExecutionResult.Ignored = testExecutionResult.Total - testExecutionResult.Executed - testExecutionResult.Pending; return(testExecutionResult); }
private TestExecutionResult CalculateSpecRunTestExecutionResult(TestExecutionResult testExecutionResult) { bool FilterIgnored(TestResult testResult) => testResult.StdOut.Contains("-> Ignored"); bool FilterPending(TestResult testResult) => testResult.StdOut.Contains("TechTalk.SpecRun.PendingTestException") || testResult.StdOut.Contains("No matching step definition found for the step."); var testResultsWithOutput = testExecutionResult.TestResults.Where(tr => !(tr?.StdOut is null)).ToArray(); testExecutionResult.Ignored = testResultsWithOutput.Where(FilterIgnored).Count(); testExecutionResult.Pending = testResultsWithOutput.Where(FilterPending).Count(); return(testExecutionResult); }
private TestExecutionResult CalculateMsTestTestExecutionResult(TestExecutionResult testExecutionResult) { testExecutionResult.Ignored = testExecutionResult.TestResults .Where(r => r.ErrorMessage != null) .Select(r => r.ErrorMessage) .Count(m => m.Contains("Assert.Inconclusive failed") && !m.Contains("One or more step definitions are not implemented yet")); testExecutionResult.Pending = testExecutionResult.TestResults .Where(r => r.ErrorMessage != null) .Select(r => r.ErrorMessage) .Count(m => m.Contains("Assert.Inconclusive failed. One or more step definitions are not implemented yet.")); return(testExecutionResult); }
private TestExecutionResult CalculateUnitTestProviderSpecificTestExecutionResult(TestExecutionResult testExecutionResult, TestRunConfiguration testRunConfiguration) { switch (testRunConfiguration.UnitTestProvider) { case UnitTestProvider.xUnit: return(CalculateXUnitTestExecutionResult(testExecutionResult)); case UnitTestProvider.MSTest: return(CalculateMsTestTestExecutionResult(testExecutionResult)); case UnitTestProvider.NUnit3: return(CalculateNUnitTestExecutionResult(testExecutionResult)); case UnitTestProvider.SpecRun: return(CalculateSpecRunTestExecutionResult(testExecutionResult)); default: throw new NotSupportedException($"The specified unit test provider is not supported: {testRunConfiguration.UnitTestProvider}"); } }