public override void TestStarted(TestCase test) { var testCase = test.ToVsTestCase(); // The test case is starting frameworkHandle.RecordStart(testCase); }
public void TestFinished(TestCase testCase) { lock (sync) { nestedCallback.TestFinished(testCase); } }
public virtual void TestFinished(TestCase testCase) { if (testCase.Passed) TestPassed(testCase); if (!testCase.Passed) TestFailed(testCase); TestComplete(testCase); }
protected override void TestFailed(TestCase testCase) { Console.WriteLine( "##teamcity[testFailed name='{0}' details='{1}']", Escape(testCase.GetDisplayName()), Escape(GetTestFailureMessage(testCase)) ); WriteOutput(testCase.GetDisplayName(), CombineWithTestCaseMessages(GetTestFailureMessage(testCase))); }
public override void TestFinished(TestCase test) { var testCase = test.ToVsTestCase(); var result = test.ToVsTestResult(); var outcome = ChutzpahExtensionMethods.ToVsTestOutcome(test.Passed); frameworkHandle.RecordResult(result); // The test case is done frameworkHandle.RecordEnd(testCase, outcome); }
public void It_will_write_file_log_messages_as_standard_out_for_failed_test() { var cb = new TeamCityConsoleRunnerCallback(); var log = new TestLog { InputTestFile = "test.js", Message = "hello" }; var result = new TestResult {Passed = false, Message = "failure"}; var tc = new TestCase { TestName = "foo", TestResults = new[] { result } }; cb.TestStarted(tc); cb.FileLog(log); cb.TestFinished(tc); Assert.Contains("##teamcity[testStdOut name='foo' out='Log Message: hello from test.js|n|nTest |'foo|' failed|n\tfailure|nin (line 0)|n|n']", _out.ToString()); }
public virtual void TestFinished(TestCase testCase) { if (testCase.Passed) { ChutzpahTracer.TraceInformation("File {0}, Test {1} passed", testCase.InputTestFile, testCase.TestName); TestPassed(testCase); } if (!testCase.Passed) { ChutzpahTracer.TraceInformation("File {0}, Test {1} failed", testCase.InputTestFile, testCase.TestName); TestFailed(testCase); } TestComplete(testCase); }
protected virtual string GetTestFailureMessage(TestCase testCase) { var errorString = ""; errorString += string.Format("Test '{0}' failed\n", testCase.GetDisplayName()); foreach (var result in testCase.TestResults.Where(x => !x.Passed)) { errorString += string.Format("\t{0}\n", result.GetFailureMessage()); } errorString += GetTestFailureLocationString(testCase); return errorString; }
private XmlElement AddTestCase(TestCase test, XmlNode results, XmlDocument document) { var testCase = document.CreateElement("test-case"); testCase.SetAttribute("name", test.TestName); testCase.SetAttribute("description", test.GetDisplayName()); testCase.SetAttribute("success", test.ResultsAllPassed ? "True" : "False"); testCase.SetAttribute("time", (test.TimeTaken / 1000m).ToString()); testCase.SetAttribute("executed", "True"); testCase.SetAttribute("asserts", "0"); testCase.SetAttribute("result", test.ResultsAllPassed ? "Success" : "Fail"); AddFailureToTestCase(test, testCase, document); results.AppendChild(testCase); return testCase; }
public void It_will_separate_file_log_messages_per_test() { var cb = new TeamCityConsoleRunnerCallback(); var log1 = new TestLog {InputTestFile = "test.js", Message = "hello"}; var log2 = new TestLog {InputTestFile = "test.js", Message = "world"}; var result = new TestResult { Passed = true }; var tc1 = new TestCase {TestName = "foo", TestResults = new[] {result}}; var tc2 = new TestCase {TestName = "bar", TestResults = new[] {result}}; cb.TestStarted(tc1); cb.FileLog(log1); cb.TestFinished(tc1); cb.TestStarted(tc2); cb.FileLog(log2); cb.TestFinished(tc2); Assert.Contains("##teamcity[testStdOut name='foo' out='Log Message: hello from test.js|n|nPassed']", _out.ToString()); Assert.Contains("##teamcity[testStdOut name='bar' out='Log Message: world from test.js|n|nPassed']", _out.ToString()); }
public virtual void TestFinished(TestCase testCase) { switch (testCase.TestOutcome) { case TestOutcome.Passed: ChutzpahTracer.TraceInformation("File {0}, Test {1} passed", testCase.InputTestFile, testCase.TestName); TestPassed(testCase); break; case TestOutcome.Failed: ChutzpahTracer.TraceInformation("File {0}, Test {1} failed", testCase.InputTestFile, testCase.TestName); TestFailed(testCase); break; case TestOutcome.Skipped: ChutzpahTracer.TraceInformation("File {0}, Test {1} skipped", testCase.InputTestFile, testCase.TestName); TestSkipped(testCase); break; default: break; } TestComplete(testCase); }
private void AddFailureToTestCase(TestCase test, XmlElement testCaseElement, XmlDocument document) { if (test.ResultsAllPassed == false) { var failure = document.CreateElement("failure"); var failureMessage = document.CreateElement("message"); var stack = document.CreateElement("stack-trace"); failure.AppendChild(failureMessage); failure.AppendChild(stack); var testFailure = test.TestResults.First(tr => tr.Passed == false); failureMessage.InnerText = testFailure.GetFailureMessage(); stack.InnerText = testFailure.StackTrace; var reason = document.CreateElement("reason"); var reasonMessage = document.CreateElement("message"); reason.AppendChild(reasonMessage); reasonMessage.InnerText = testFailure.Message; testCaseElement.AppendChild(failure); testCaseElement.AppendChild(reason); } }
protected override void TestFailed(TestCase testCase) { var output = string.Format("testFailed name='{0}' details='{1}'", Escape(testCase.GetDisplayName()), Escape(GetTestFailureMessage(testCase))); FailedTests.Add(output); WriteLine(output); WriteOutput(testCase.GetDisplayName(), GetTestFailureMessage(testCase)); }
public override void TestStarted(TestCase testCase) { WriteLine("testStarted name='{0}'", Escape(testCase.GetDisplayName())); }
protected override void TestComplete(TestCase testCase) { WriteFinished(testCase.GetDisplayName(), testCase.TimeTaken); }
protected override string GetTestFailureLocationString(TestCase testCase) { if (vsoutput) { var s = String.Empty; foreach (var result in testCase.TestResults.Where(x => !x.Passed)) { s += string.Format("{0}({1},{2}):{3} {4} {5}: {6}: {7}\n", testCase.InputTestFile, testCase.Line, testCase.Column, "", "error", "C0001", string.Format("Test '{0}' failed", testCase.GetDisplayName()), result.GetFailureMessage()); } return s; } return base.GetTestFailureLocationString(testCase); }
protected override void TestComplete(TestCase testCase) { ++testCount; PrintRunningTestCount(); }
protected virtual string GetTestFailureLocationString(TestCase testCase) { return string.Format("in {0} (line {1})\n\n", testCase.InputTestFile, testCase.Line); }
protected override void TestFailed(TestCase testCase) { ClearCounter(); Console.ForegroundColor = ConsoleColor.Red; Console.Error.WriteLine("{0} [FAIL]", testCase.GetDisplayName()); Console.ResetColor(); Console.Error.WriteLine(Indent(GetTestFailureMessage(testCase))); Console.Error.WriteLine(); }
/// <summary> /// Add a test case /// </summary> /// <param name="testCase"></param> public void AddTestCase(TestCase testCase) { tests.Add(testCase); var module = testCase.ModuleName ?? ""; if (!TestGroups.ContainsKey(module)) { TestGroups[module] = new List<TestCase>(); } TestGroups[module].Add(testCase); }
protected override void TestPassed(TestCase result) { SetStatusBarMessage(GetStatusBarMessage(result)); }
protected virtual void TestSkipped(TestCase testCase) { }
public override void TestStarted(TestCase testCase) { _testCaseMessages.Clear(); Console.WriteLine( "##teamcity[testStarted name='{0}']", Escape(testCase.GetDisplayName())); }
protected virtual void TestPassed(TestCase testCase) { }
protected virtual void TestFailed(TestCase testCase) { }
protected override void TestPassed(TestCase testCase) { WriteOutput(testCase.GetDisplayName(), CombineWithTestCaseMessages("Passed")); }
protected override void TestPassed(TestCase testCase) { PassedTests.Add(testCase.GetDisplayName()); WriteOutput(testCase.GetDisplayName(), "Passed"); }
protected override void TestFailed(TestCase result) { var errorMessage = GetTestFailureMessage(result); WriteToOutputPaneAndErrorTaskList(result.InputTestFile, errorMessage, errorMessage, result.Line); SetStatusBarMessage(GetStatusBarMessage(result)); }
protected virtual void TestComplete(TestCase testCase) { }
public virtual void TestStarted(TestCase testCase) { }