Ejemplo n.º 1
0
        void ExtractTestResult(XmlNode nodeGroup)
        {
            // Success
            var nodeTestCase = nodeGroup.SelectSingleNode("TestCase");

            if (nodeTestCase != null)
            {
                _testcase = new Reporter.TestCase(nodeTestCase);

                Success       = _testcase.OverallResult.Success;
                Duration      = _testcase.OverallResult.Duration;
                StandardOut   = _testcase.OverallResult.StdOut;
                StandardError = _testcase.OverallResult.StdErr;

                ExtractMessages();

                // Statistics
                ExtractOverallResults(nodeGroup);

                GenerateErrorMessage();
            }
            else
            {
                SetInvalidTestRunnerOutput();
            }
        }
Ejemplo n.º 2
0
        private void ExtractTestCase(XmlNode nodeTestCase)
        {
            var testcase = new Reporter.TestCase(nodeTestCase);

            // Create TestResult
            var result = new TestResult(testcase, _settings, true);

            TestResults.Add(result);
        }
Ejemplo n.º 3
0
        public TestResult(Reporter.TestCase testcase, Settings settings)
        {
            _settings = settings ?? new Settings();
            _testcase = testcase;

            Duration      = _testcase.OverallResult.Duration;
            Name          = _testcase.Name;
            Outcome       = _testcase.OverallResult.Success ? TestOutcomes.Passed : TestOutcomes.Failed;
            StandardOut   = _testcase.OverallResult.StdOut;
            StandardError = _testcase.OverallResult.StdErr;

            OverallResults = new Reporter.OverallResults();

            ExtractMessages();
            GenerateMessages();
        }
Ejemplo n.º 4
0
        void ExtractTestResult(XmlNode nodeGroup)
        {
            // Retrieve data from TestCases that were run
            var nodesTestCases = nodeGroup.SelectNodes("TestCase");

            _testcasecount = nodesTestCases.Count;

            if (_testcasecount == 0)
            {
                // Special case. It appears the used test case name could not be found by Catch2.
                // As such the test case is effectively skipped.
                // This is an edge case that can typically be resolved by changing the test case name.
                // So tell the user about it.
                Outcome      = TestOutcomes.Skipped;
                ErrorMessage = $"Testcase could not be run. Probably the used testcase name is the cause. Change the testcase name and try again. Typically, this problem is encountered when the last character of the testcase name is a space.";
                return;
            }
            else
            {
                foreach (XmlNode nodeTestCase in nodesTestCases)
                {
                    var testcase = new Reporter.TestCase(nodeTestCase);
                    if (_testcasecount != 1 && !testcase.Name.Equals(Name))
                    {
                        continue;
                    }

                    _testcase = testcase;

                    Outcome       = _testcase.OverallResult.Success ? TestOutcomes.Passed : TestOutcomes.Failed;
                    Duration      = _testcase.OverallResult.Duration;
                    StandardOut   = _testcase.OverallResult.StdOut;
                    StandardError = _testcase.OverallResult.StdErr;

                    ExtractMessages();

                    // Statistics
                    ExtractOverallResults(nodeGroup);

                    GenerateMessages();
                    return;
                }
            }

            SetInvalidTestRunnerOutput();
        }