/// <summary> /// Creates the initial results document and its XElements. /// </summary> private void CreateInitialDocument() { TestRun = CreateElement("TestRun"); TestRunConfiguration = CreateElement("TestSettings"); TestRun.Add(TestRunConfiguration); ResultSummary = CreateElement("ResultSummary"); Counters = CreateElement("Counters"); ResultSummary.Add(Counters); TestRun.Add(ResultSummary); Times = CreateElement("Times"); TestRun.Add(Times); TestDefinitions = CreateElement("TestDefinitions"); TestRun.Add(TestDefinitions); TestLists = CreateElement("TestLists"); TestRun.Add(TestLists); TestEntries = CreateElement("TestEntries"); TestRun.Add(TestEntries); Results = CreateElement("Results"); TestRun.Add(Results); RunOutcome = TestOutcome.NotExecuted; }
public static TestRun ParseTestResults(bool includeNotRunTests = false) { ScrollToTop(); TestRun testResults = new TestRun(); string tmp = GetOutput().ReplaceIgnoreCase(Path.GetDirectoryName(SolutionFile), "${SolutionDir}"); tmp = Regex.Replace(tmp, "Found [0-9]+ tests in executable", "Found ${NrOfTests} tests in executable"); testResults.testOutput = Regex.Replace(tmp, @"(========== Run test finished: [0-9]+ run )\([0-9:,\.]+\)( ==========)", "$1($${RunTime})$2"); foreach (TreeNode testGroupNode in GetTestCaseTree().Nodes) { if (!includeNotRunTests && testGroupNode.Text.StartsWith("Not Run Tests")) { continue; } if (!EnsureTestGroupNodeIsOnScreen(testGroupNode)) { continue; } testResults.Add(ParseTestGroup(testGroupNode)); } return(testResults); }
public void FindNumberOfErrorsShouldReturnOneError() { var testSuite = new TestSuite(); var testRun = new TestRun("test with error", TestType.ContentAnalysis); testRun.Add(new TestResult(ResultType.Error, new Location(""), "feil")); testSuite.AddTestRun(testRun); testSuite.FindNumberOfErrors().Should().Be(1); }
private static TestSuite CreateTestSuite(params TestResult[] testResults) { var testSuite = new TestSuite(); var testRun = new TestRun("test with error", TestType.ContentAnalysis); if (testResults != null) { foreach (var testResult in testResults) { testRun.Add(testResult); } } testSuite.AddTestRun(testRun); return(testSuite); }
public void Print(IEnumerable <CompareResult> results, string outputPath) { if (outputPath == null) { return; } var testRun = new TestRun(); foreach (var result in results) { testRun.Add(BuildUnitTest(result), BuildUnitTestResult(result)); } XmlSerializer ser = new XmlSerializer(typeof(TestRun)); using (var writer = XmlWriter.Create(outputPath, new XmlWriterSettings() { Indent = true })) { ser.Serialize(writer, testRun); } }
private void AddTestResult(ResultType resultType, ILocation location, string message) { TestResults.Add(new TestResult(resultType, location, message)); }