Example #1
0
 private void SetOutcome(TestOutcomes outcome)
 {
     _outcome = outcome;
     if ((_parent != null) && (_parent.Outcome > _outcome))
     {
         _parent.Outcome = _outcome;
     }
 }
Example #2
0
 private void SetInvalidTestRunnerOutput()
 {
     Outcome        = TestOutcomes.Failed;
     OverallResults = new Reporter.OverallResults();
     ErrorMessage   = $"Invalid test runner output.{Environment.NewLine}"
                      + $"-------------------------------------------------------------------------------{Environment.NewLine}"
                      + $"{_xmloutput}"
                      + $"-------------------------------------------------------------------------------";
 }
Example #3
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 != _testname)
                    {
                        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();
        }