public JunitTestResultBuilder AddSuccessTestResult()

in e2etest/GuestProxyAgentTest/Utilities/JUnitTestResultBuilder.cs [56:93]


        public JunitTestResultBuilder AddSuccessTestResult(string testScenarioName, string testName, string stdOutMessage, long durationInMilliseconds = 0)
        {
            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));

                XmlElement successTestCaseElement = doc.CreateElement("testcase");
                successTestCaseElement.SetAttribute("name", testName);
                successTestCaseElement.SetAttribute("classname", testGroupName + "." + testScenarioName);
                successTestCaseElement.SetAttribute("time", ((double)durationInMilliseconds / 1000).ToString());
                testSuite.AppendChild(successTestCaseElement);

                XmlElement systemOutElement = doc.CreateElement("system-out");
                systemOutElement.InnerText = stdOutMessage;
                successTestCaseElement.AppendChild(systemOutElement);
            }

            return this;
        }