public void Parse(string content) { string[] testCases = getTestCases(content); foreach (var testCase in testCases) { string name = getname(testCase); var status = TestStatus.Passed; if (testCase.Contains("executed=\"False\"")) status = TestStatus.Ignored; else if (testCase.Contains("success=\"False\"")) status = TestStatus.Failed; string message = ""; if (status.Equals(TestStatus.Ignored)) message = getMessage(testCase); else if (status.Equals(TestStatus.Failed)) message = getMessage(testCase); IStackLine[] stackTrace = new IStackLine[] {}; if (status.Equals(TestStatus.Failed)) stackTrace = getStackTrace(testCase); _result.Add(new TestResult(status, name, message, stackTrace)); } }
public TestResult(TestRunStatus status, string name, string message, IStackLine[] stackTrace) { _status = status; _name = name; _message = message; _stackTrace = stackTrace; }
public TestResult(TestRunner runner, TestRunStatus status, string name, string message, IStackLine[] stackTrace, double milliseconds) { _runner = runner; _status = status; _name = name; _message = message; _stackTrace = stackTrace; TimeSpent = TimeSpan.FromMilliseconds(milliseconds); }
public void Parse(string content, TestRunInfo[] runInfos, bool isPartialTestRun) { _content = content; _testSources = runInfos; _isPartialTestRuns = isPartialTestRun; var testSuites = getTestSuites(); Debug.WriteDetail(string.Format("Found {0} test sections", testSuites.Length)); foreach (var testSuite in testSuites) { _result.Clear(); string[] testCases = getTestCases(testSuite); Debug.WriteDetail(string.Format("Found {0} test cases in section {1}", testCases.Length, getAssemblyName(testSuite))); foreach (var testCase in testCases) { string name = getname(testCase); var status = TestRunStatus.Passed; if (testCase.Contains("executed=\"False\"")) { status = TestRunStatus.Ignored; } else if (testCase.Contains("success=\"False\"")) { status = TestRunStatus.Failed; } string message = ""; if (status.Equals(TestRunStatus.Ignored)) { message = getMessage(testCase); } else if (status.Equals(TestRunStatus.Failed)) { message = getMessage(testCase); } IStackLine[] stackTrace = new IStackLine[] {}; if (status.Equals(TestRunStatus.Failed)) { stackTrace = getStackTrace(testCase); } _result.Add(new TestResult(_runner, status, name, message, stackTrace)); } var runInfo = matchToTestSource(testSuite); if (runInfo == null) { Debug.WriteError("Could not match test suite {0} to any of the tested assemblies", getAssemblyName(testSuite)); continue; } var results = getTestResults(runInfo); results.SetTimeSpent(getTimeSpent(testSuite)); _runResults.Add(results); } }
public void Parse(string content, TestRunInfo[] runInfos, bool isPartialTestRun) { _content = content; _testSources = runInfos; _isPartialTestRuns = isPartialTestRun; var testSuites = getTestSuites(); Debug.WriteDetail(string.Format("Found {0} test sections", testSuites.Length)); foreach (var testSuite in testSuites) { _result.Clear(); string[] testCases = getTestCases(testSuite); Debug.WriteDetail(string.Format("Found {0} test cases in section {1}", testCases.Length, getAssemblyName(testSuite))); foreach (var testCase in testCases) { string name = getname(testCase); var status = TestRunStatus.Passed; if (testCase.Contains("executed=\"False\"")) status = TestRunStatus.Ignored; else if (testCase.Contains("success=\"False\"")) status = TestRunStatus.Failed; string message = ""; if (status.Equals(TestRunStatus.Ignored)) message = getMessage(testCase); else if (status.Equals(TestRunStatus.Failed)) message = getMessage(testCase); IStackLine[] stackTrace = new IStackLine[] {}; if (status.Equals(TestRunStatus.Failed)) stackTrace = getStackTrace(testCase); _result.Add(new TestResult(_runner, status, name, message, stackTrace)); } var runInfo = matchToTestSource(testSuite); if (runInfo == null) { Debug.WriteError("Could not match test suite {0} to any of the tested assemblies", getAssemblyName(testSuite)); continue; } var results = getTestResults(runInfo); results.SetTimeSpent(getTimeSpent(testSuite)); _runResults.Add(results); } }
public void Parse(string content, TestRunInfo[] runInfos) { _content = content; _testSources = runInfos; var testSuites = getTestSuites(); foreach (var testSuite in testSuites) { _result.Clear(); string[] testCases = getTestCases(testSuite); foreach (var testCase in testCases) { string name = getname(testCase); var status = TestRunStatus.Passed; if (testCase.Contains("executed=\"False\"")) status = TestRunStatus.Ignored; else if (testCase.Contains("success=\"False\"")) status = TestRunStatus.Failed; string message = ""; if (status.Equals(TestRunStatus.Ignored)) message = getMessage(testCase); else if (status.Equals(TestRunStatus.Failed)) message = getMessage(testCase); IStackLine[] stackTrace = new IStackLine[] {}; if (status.Equals(TestRunStatus.Failed)) stackTrace = getStackTrace(testCase); _result.Add(new TestResult(status, name, message, stackTrace)); } var runInfo = matchToTestSource(testSuite); if (runInfo == null) continue; var results = getTestResults(runInfo); results.SetTimeSpent(getTimeSpent(testSuite)); _runResults.Add(results); } }
//private void logTest(string prefix, TestItem item) //{ //Debug.WriteDebug("{6} ({2}.{1}) from {0} named {4} saying {3} in {5}", item.Key, item.Value.Status, item.Value.Runner, item.Value.Name, item.Value.Message, getStackTrace(item.Value.StackTrace), prefix); //} private string getStackTrace(IStackLine[] iStackLine) { var builder = new StringBuilder(); foreach (var line in iStackLine) builder.Append(string.Format(" {0}, {1}:{2}", line.File, line.Method, line.LineNumber)); return builder.ToString(); }