Пример #1
0
        public override void TestStarted(TestCase test)
        {
            var testCase = test.ToVsTestCase();

            // The test case is starting
            frameworkHandle.RecordStart(testCase);
        }
Пример #2
0
        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);
     }
 }
Пример #4
0
        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)));
        }
Пример #6
0
        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);
        }
Пример #7
0
        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);
        }
Пример #8
0
            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());
            }
Пример #9
0
        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);
        }
Пример #10
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;
        }
Пример #11
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;
        }
Пример #12
0
            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());
            }
Пример #13
0
        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);
        }
Пример #14
0
        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);
            }
        }
Пример #15
0
        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));
        }
Пример #16
0
 public override void TestStarted(TestCase testCase)
 {
     WriteLine("testStarted name='{0}'", Escape(testCase.GetDisplayName()));
 }
Пример #17
0
 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();
 }
Пример #20
0
 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();
        }
Пример #22
0
        /// <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));
 }
Пример #24
0
 protected virtual void TestSkipped(TestCase testCase) { }
 public override void TestStarted(TestCase testCase)
 {
     _testCaseMessages.Clear();
     Console.WriteLine(
         "##teamcity[testStarted name='{0}']", Escape(testCase.GetDisplayName()));
 }
Пример #26
0
 protected virtual void TestPassed(TestCase testCase) { }
Пример #27
0
 protected virtual void TestFailed(TestCase testCase) { }
 protected override void TestPassed(TestCase testCase)
 {
     WriteOutput(testCase.GetDisplayName(), CombineWithTestCaseMessages("Passed"));
 }
Пример #29
0
 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));
 }
Пример #31
0
 protected virtual void TestComplete(TestCase testCase) { }
Пример #32
0
 public virtual void TestStarted(TestCase testCase) { }