public JunitTestResultBuilder AddAbortedTestResult()

in e2etest/GuestProxyAgentTest/Utilities/JUnitTestResultBuilder.cs [159:194]


        public JunitTestResultBuilder AddAbortedTestResult(string testScenarioName, string testName, string message)
        {
            lock (this)
            {
                XmlDocument doc = null!;
                if (!testSuiteMap.ContainsKey(testScenarioName))
                {
                    doc = new XmlDocument();
                    var testsuites = doc.CreateElement("testsuites");
                    doc.AppendChild(testsuites);
                    XmlElement testSuiteElement = doc.CreateElement("testsuite");
                    testSuiteElement.SetAttribute("name", testGroupName + "." + testScenarioName);
                    testSuiteElement.SetAttribute("tests", "0");
                    testSuiteElement.SetAttribute("errors", "0");
                    testSuiteElement.SetAttribute("failures", "0");
                    testSuiteElement.SetAttribute("skipped", "0");
                    testSuiteElement.SetAttribute("timestamp", DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss"));
                    testsuites.AppendChild(testSuiteElement);
                    testSuiteMap[testScenarioName] = (doc, testSuiteElement);
                }
                doc = testSuiteMap[testScenarioName].Item1;
                var testSuite = testSuiteMap[testScenarioName].Item2;
                testSuite.SetAttribute("tests", StringAdd(testSuite.GetAttribute("tests"), 1));
                testSuite.SetAttribute("skipped", StringAdd(testSuite.GetAttribute("skipped"), 1));
                XmlElement abortedTestCaseElement = doc.CreateElement("testcase");
                abortedTestCaseElement.SetAttribute("name", testName);
                abortedTestCaseElement.SetAttribute("classname", testGroupName + "." + testScenarioName);
                abortedTestCaseElement.SetAttribute("time", "0");
                testSuite.AppendChild(abortedTestCaseElement);
                XmlElement abortedElement = doc.CreateElement("skipped");
                abortedElement.SetAttribute("message", "Test case aborted.");
                abortedElement.InnerText = message;
                abortedTestCaseElement.AppendChild(abortedElement);
            }
            return this;
        }