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)));
        }
Exemplo n.º 2
0
        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;
        }
 protected override void TestPassed(TestCase testCase)
 {
     PassedTests.Add(testCase.GetDisplayName());
     WriteOutput(testCase.GetDisplayName(), "Passed");
 }
        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));
        }
 protected override void TestComplete(TestCase testCase)
 {
     WriteFinished(testCase.GetDisplayName(), testCase.TimeTaken);
 }
 public override void TestStarted(TestCase testCase)
 {
     WriteLine("testStarted name='{0}'", Escape(testCase.GetDisplayName()));
 }
        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 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();
        }
Exemplo n.º 9
0
        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;
        }
 protected override void TestPassed(TestCase testCase)
 {
     WriteOutput(testCase.GetDisplayName(), CombineWithTestCaseMessages("Passed"));
 }
 public override void TestStarted(TestCase testCase)
 {
     _testCaseMessages.Clear();
     Console.WriteLine(
         "##teamcity[testStarted name='{0}']", Escape(testCase.GetDisplayName()));
 }
Exemplo n.º 12
0
 protected string GetStatusBarMessage(TestCase result)
 {
     var title = result.GetDisplayName();
     return string.Format("{0} ({1})", title, result.Passed ? "passed" : "failed");
 }
 protected override void TestSkipped(TestCase testCase)
 {
     Console.WriteLine(
         "##teamcity[testIgnored name='{0}']", Escape(testCase.GetDisplayName()));
 }