예제 #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) { }