示例#1
0
        static void Main(string[] args)
        {
            var tc1Step1 = new TestStepResult("Test step 1", true);
            var tc2step2 = new TestStepResult("Test step 2", false);
            var tc3step3 = new TestStepResult("Test step 3", true);

            TestStepResults results = new TestStepResults();

            results.Add(tc1Step1);
            results.Add(tc2step2);
            results.Add(tc3step3);

            TestCaseResult caseresult = new TestCaseResult("a sample description");

            TestCaseResults caseresults = new TestCaseResults();

            TestRun run = new TestRun("25/2/2020", "RETRER2134", "12345");
        }
示例#2
0
        private TestRun GetFailedTestRunObj(List <TestCaseResult> failedTestCases)
        {
            _testRunFailed = new TestRun("13:23:34 3-3-2020", "INGHTBGFTR", "sdr01");
            TestCaseResults testCaseResults = new TestCaseResults();

            foreach (var testcase in failedTestCases)
            {
                TestCaseResult  testcaseRes     = new TestCaseResult(testcase.getTestCaseName());
                TestStepResults testStepResults = new TestStepResults();
                foreach (var testStepResult in testcase.GetAllTestStepResults().GetTestStepResults())
                {
                    bool isPassed = testStepResult.IsPassed();
                    if (!isPassed)
                    {
                        testStepResults.Add(testStepResult);
                    }
                }
                testcaseRes.Add(testStepResults);
                testCaseResults.Add(testcaseRes);
            }
            _testRunFailed.Add(testCaseResults);
            return(_testRunFailed);
        }
示例#3
0
 public void Add(TestCaseResults results)
 {
     _resultRefernce = results;
 }
示例#4
0
        public override void Report(string path)
        {
            var         DateTime1 = testRunObj.GetDateTime();
            var         HostName1 = testRunObj.GetHostName();
            var         userId1   = testRunObj.UserId();
            XmlDocument xmlDoc    = new XmlDocument();
            XmlNode     rootNode  = xmlDoc.CreateElement("TestRun");

            xmlDoc.AppendChild(rootNode);
            XmlNode userNode = xmlDoc.CreateElement("DateTime");

            userNode.InnerText = DateTime1;
            rootNode.AppendChild(userNode);
            userNode           = xmlDoc.CreateElement("HostName");
            userNode.InnerText = HostName1;
            rootNode.AppendChild(userNode);
            userNode           = xmlDoc.CreateElement("UserID");
            userNode.InnerText = userId1;
            rootNode.AppendChild(userNode);
            userNode = xmlDoc.CreateElement("version");
            rootNode.AppendChild(userNode);
            XmlElement XmlElementTestCaseResults = xmlDoc.CreateElement("TestCaseResults");
            XmlElement xmlElementTestStepResults = xmlDoc.CreateElement("TestStepResults");
            XmlElement xmlElementTestCaseResult  = xmlDoc.CreateElement("TestCaseResult");

            xmlElementTestCaseResult.AppendChild(xmlElementTestStepResults);
            var             Printxml        = testRunObj;
            TestCaseResults testCaseResult  = testRunObj.GetListofTestCaseResults();
            var             testCaseResults = testCaseResult.GetTestCaseResults();

            foreach (var testCaseresult in testCaseResults)
            {
                TestStepResults teststepresult  = new TestStepResults();
                var             teststepresults = testCaseresult.GetAllTestStepResults();
                userNode           = xmlDoc.CreateElement("TestCaseName");
                userNode.InnerText = testCaseresult.getTestCaseName();
                xmlElementTestCaseResult.AppendChild(userNode);
                userNode           = xmlDoc.CreateElement("TestCaseHash");
                userNode.InnerText = "N/A";
                xmlElementTestCaseResult.AppendChild(userNode);
                foreach (var testCaseresult1 in teststepresults.GetTestStepResults())
                {
                    XmlElement xmlElementTestStepResult = xmlDoc.CreateElement("TestStepResult");
                    userNode           = xmlDoc.CreateElement("LogBeginLine");
                    userNode.InnerText = null;
                    xmlElementTestStepResult.AppendChild(userNode);
                    userNode           = xmlDoc.CreateElement("Description");
                    userNode.InnerText = testCaseresult1.GetDescription();
                    xmlElementTestStepResult.AppendChild(userNode);
                    userNode           = xmlDoc.CreateElement("Expected");
                    userNode.InnerText = "N/A";
                    xmlElementTestStepResult.AppendChild(userNode);
                    userNode           = xmlDoc.CreateElement("Actual");
                    userNode.InnerText = "N/A";
                    xmlElementTestStepResult.AppendChild(userNode);
                    userNode = xmlDoc.CreateElement("Attachment");
                    xmlElementTestStepResult.AppendChild(userNode);
                    userNode = xmlDoc.CreateElement("Passed");
                    var fail = testCaseresult1.IsPassed();
                    userNode.InnerText = Convert.ToString(fail);
                    xmlElementTestStepResult.AppendChild(userNode);
                    userNode           = xmlDoc.CreateElement("LogEndLine");
                    userNode.InnerText = "N/A";
                    xmlElementTestStepResult.AppendChild(userNode);
                    xmlElementTestStepResults.AppendChild(xmlElementTestStepResult);
                }
                XmlElementTestCaseResults.AppendChild(xmlElementTestCaseResult);
                rootNode.AppendChild(XmlElementTestCaseResults);
            }
            XmlElementTestCaseResults.AppendChild(xmlElementTestCaseResult);
            Console.WriteLine("Data Written to Xml file ");
            xmlDoc.Save(path + ("Filexml.xml"));
        }