コード例 #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);
        }
コード例 #3
0
 public void TestFinished(TestCase testCase)
 {
     lock (sync)
     {
         nestedCallback.TestFinished(testCase);
     }
 }
コード例 #4
0
ファイル: RunnerCallback.cs プロジェクト: pimterry/chutzpah
        public virtual void TestFinished(TestCase testCase)
        {
            if (testCase.Passed)
                TestPassed(testCase);
            if (!testCase.Passed)
                TestFailed(testCase);

            TestComplete(testCase);
        }
コード例 #5
0
        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
ファイル: RunnerCallback.cs プロジェクト: sirrocco/chutzpah
        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);
 }
コード例 #18
0
        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);
        }
コード例 #19
0
 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);
 }
コード例 #21
0
        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);

        }
コード例 #23
0
 protected override void TestPassed(TestCase result)
 {
     SetStatusBarMessage(GetStatusBarMessage(result));
 }
コード例 #24
0
 protected virtual void TestSkipped(TestCase testCase) { }
コード例 #25
0
 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) { }
コード例 #28
0
 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");
 }
コード例 #30
0
 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) { }