Esempio n. 1
0
 private static void ResetSplunkVariables()
 {
     //Re-Initialising the variables
     sp             = new SelectedPlan();
     recent         = null;
     destFilepath   = null;
     trxFilePath    = null;
     RunId          = null;
     sourceFilePath = null;
     tcmPath        = null;
     resultFile     = null;
     buildPath      = null;
     controller     = false;
     firstTry       = false;
     prFailure      = false;
 }
        public static bool GenerateForFailure(int i, SelectedPlan RunReport, string suiteName)
        {
            try
            {
                Console.WriteLine("Appending values into XML file for splog as 0 for the test execution failure..");
                XmlDocument document = new XmlDocument();
                document.Load(combinedPath);
                XmlElement testElement = document.DocumentElement;

                //P1 Results
                testElement.SetAttribute("P1Total", i.ToString());
                testElement.SetAttribute("P1Passed", i.ToString());
                testElement.SetAttribute("P1Failed", i.ToString());
                testElement.SetAttribute("P1Blocked", i.ToString());
                testElement.SetAttribute("P1Active", i.ToString());
                testElement.SetAttribute("P1Inconclusive", i.ToString());
                testElement.SetAttribute("P1Aborted", i.ToString());
                testElement.SetAttribute("P1Error", i.ToString());
                testElement.SetAttribute("P1Other", i.ToString());

                //P2 Results
                testElement.SetAttribute("P2Total", i.ToString());
                testElement.SetAttribute("P2Passed", i.ToString());
                testElement.SetAttribute("P2Failed", i.ToString());
                testElement.SetAttribute("P2Blocked", i.ToString());
                testElement.SetAttribute("P2Active", i.ToString());
                testElement.SetAttribute("P2Inconclusive", i.ToString());
                testElement.SetAttribute("P2Aborted", i.ToString());
                testElement.SetAttribute("P2Error", i.ToString());
                testElement.SetAttribute("P2Other", i.ToString());

                //P3 Results
                testElement.SetAttribute("P3Total", i.ToString());
                testElement.SetAttribute("P3Passed", i.ToString());
                testElement.SetAttribute("P3Failed", i.ToString());
                testElement.SetAttribute("P3Blocked", i.ToString());
                testElement.SetAttribute("P3Active", i.ToString());
                testElement.SetAttribute("P3Inconclusive", i.ToString());
                testElement.SetAttribute("P3Aborted", i.ToString());
                testElement.SetAttribute("P3Error", i.ToString());
                testElement.SetAttribute("P3Other", i.ToString());

                // Overall Result
                testElement.SetAttribute(suiteName + "TestRunId", RunReport.runId.ToString());
                testElement.SetAttribute(suiteName + "StartTime", RunReport.StartTime);
                testElement.SetAttribute(suiteName + "EndTime", RunReport.EndTime);
                testElement.SetAttribute(suiteName + "Total", i.ToString());
                testElement.SetAttribute(suiteName + "Passed", i.ToString());
                testElement.SetAttribute(suiteName + "Failed", i.ToString());
                testElement.SetAttribute(suiteName + "Blocked", i.ToString());
                testElement.SetAttribute(suiteName + "Active", i.ToString());
                testElement.SetAttribute(suiteName + "Inconclusive", i.ToString());
                testElement.SetAttribute(suiteName + "Aborted", i.ToString());
                testElement.SetAttribute(suiteName + "Error", i.ToString());
                testElement.SetAttribute(suiteName + "Other", i.ToString());

                document.AppendChild(testElement);

                document.Save(combinedPath);

                //Logging all the value
                LogMessageToFile("The Execution report :");
                LogMessageToFile("Test Run Id is :" + RunReport.runId.ToString());
                LogMessageToFile("Start Time of testrun is :" + RunReport.StartTime.ToString());
                LogMessageToFile("End Time of the testrun is :" + RunReport.EndTime.ToString());
                LogMessageToFile("The int Number passed is : " + i.ToString());
                LogMessageToFile("Test Execution failed");
                Console.WriteLine("Done");
            }
            catch (Exception exe)
            {
                return(false);
            }
            return(true);
        }
        public static bool Generate(SelectedPlan RunReport, string suiteName)
        {
            try
            {
                Console.WriteLine("Appending values into XML file for splog..");
                LogMessageToFile("Appending values into XML file for splog..");
                XmlDocument document = new XmlDocument();
                document.Load(combinedPath);
                XmlElement testElement = document.DocumentElement;

                //P1 Results
                testElement.SetAttribute("P1Total", RunReport.p1Total.ToString());
                testElement.SetAttribute("P1Passed", RunReport.p1Passed.ToString());
                testElement.SetAttribute("P1Failed", RunReport.p1Failed.ToString());
                testElement.SetAttribute("P1Blocked", RunReport.p1Blocked.ToString());
                testElement.SetAttribute("P1Active", RunReport.p1Active.ToString());
                testElement.SetAttribute("P1Inconclusive", RunReport.p1Inconclusive.ToString());
                testElement.SetAttribute("P1Aborted", RunReport.p1Aborted.ToString());
                testElement.SetAttribute("P1Error", RunReport.p1Error.ToString());
                testElement.SetAttribute("P1Other", RunReport.p1Other.ToString());

                //P2 Results
                testElement.SetAttribute("P2Total", RunReport.p2Total.ToString());
                testElement.SetAttribute("P2Passed", RunReport.p2Passed.ToString());
                testElement.SetAttribute("P2Failed", RunReport.p2Failed.ToString());
                testElement.SetAttribute("P2Blocked", RunReport.p2Blocked.ToString());
                testElement.SetAttribute("P2Active", RunReport.p2Active.ToString());
                testElement.SetAttribute("P2Inconclusive", RunReport.p2Inconclusive.ToString());
                testElement.SetAttribute("P2Aborted", RunReport.p2Aborted.ToString());
                testElement.SetAttribute("P2Error", RunReport.p2Error.ToString());
                testElement.SetAttribute("P2Other", RunReport.p2Other.ToString());

                //P3 Results
                testElement.SetAttribute("P3Total", RunReport.p3Total.ToString());
                testElement.SetAttribute("P3Passed", RunReport.p3Passed.ToString());
                testElement.SetAttribute("P3Failed", RunReport.p3Failed.ToString());
                testElement.SetAttribute("P3Blocked", RunReport.p3Blocked.ToString());
                testElement.SetAttribute("P3Active", RunReport.p3Active.ToString());
                testElement.SetAttribute("P3Inconclusive", RunReport.p3Inconclusive.ToString());
                testElement.SetAttribute("P3Aborted", RunReport.p3Aborted.ToString());
                testElement.SetAttribute("P3Error", RunReport.p3Error.ToString());
                testElement.SetAttribute("P3Other", RunReport.p3Other.ToString());

                // Overall Result
                testElement.SetAttribute(suiteName + "TestRunId", RunReport.runId.ToString());
                testElement.SetAttribute(suiteName + "StartTime", RunReport.StartTime);
                testElement.SetAttribute(suiteName + "EndTime", RunReport.EndTime);
                testElement.SetAttribute(suiteName + "Total", RunReport.total.ToString());
                testElement.SetAttribute(suiteName + "Passed", RunReport.passed.ToString());
                testElement.SetAttribute(suiteName + "Failed", RunReport.failed.ToString());
                testElement.SetAttribute(suiteName + "Blocked", RunReport.blocked.ToString());
                testElement.SetAttribute(suiteName + "Active", RunReport.active.ToString());
                testElement.SetAttribute(suiteName + "Inconclusive", RunReport.Inconclusive.ToString());
                testElement.SetAttribute(suiteName + "Aborted", RunReport.aborted.ToString());
                testElement.SetAttribute(suiteName + "Error", RunReport.error.ToString());
                testElement.SetAttribute(suiteName + "Other", RunReport.other.ToString());
                testElement.SetAttribute(suiteName + "NotExecuted", RunReport.notExecuted.ToString());

                document.AppendChild(testElement);

                document.Save(combinedPath);

                //Loggin all the value
                LogMessageToFile("The Execution report :");
                LogMessageToFile("Test Run Id is :" + RunReport.runId.ToString());
                LogMessageToFile("Start Time of testrun is :" + RunReport.StartTime.ToString());
                LogMessageToFile("End Time of the testrun is :" + RunReport.EndTime.ToString());

                LogMessageToFile("Total Test cases is :" + RunReport.total.ToString());
                LogMessageToFile("Total Test cases passed is :" + RunReport.passed.ToString());
                LogMessageToFile("Total Test cases failed is :" + RunReport.failed.ToString());
                LogMessageToFile("Total Test cases blocked is :" + RunReport.blocked.ToString());
                LogMessageToFile("Total Test cases active is :" + RunReport.active.ToString());
                LogMessageToFile("Total Test cases inconclusive is :" + RunReport.Inconclusive.ToString());
                LogMessageToFile("Total Test cases aborted is :" + RunReport.aborted.ToString());
                LogMessageToFile("Total Test cases error is :" + RunReport.error.ToString());
                LogMessageToFile("Total Test cases other is :" + RunReport.other.ToString());

                LogMessageToFile("P1 Total Test cases passed is :" + RunReport.p1Passed.ToString());
                LogMessageToFile("P1 Total Test cases failed is :" + RunReport.p1Failed.ToString());
                LogMessageToFile("P1 Total Test cases blocked is :" + RunReport.p1Blocked.ToString());
                LogMessageToFile("P1 Total Test cases active is :" + RunReport.p1Active.ToString());
                LogMessageToFile("P1 Total Test cases inconclusive is :" + RunReport.p1Inconclusive.ToString());
                LogMessageToFile("P1 Total Test cases aborted is :" + RunReport.p1Aborted.ToString());
                LogMessageToFile("P1 Total Test cases error is :" + RunReport.p1Error.ToString());
                LogMessageToFile("P1 Total Test cases other is :" + RunReport.p1Other.ToString());

                LogMessageToFile("P2 Total Test cases passed is :" + RunReport.p2Passed.ToString());
                LogMessageToFile("P2 Total Test cases failed is :" + RunReport.p2Failed.ToString());
                LogMessageToFile("P2 Total Test cases blocked is :" + RunReport.p2Blocked.ToString());
                LogMessageToFile("P2 Total Test cases active is :" + RunReport.p2Active.ToString());
                LogMessageToFile("P2 Total Test cases inconclusive is :" + RunReport.p2Inconclusive.ToString());
                LogMessageToFile("P2 Total Test cases aborted is :" + RunReport.p2Aborted.ToString());
                LogMessageToFile("P2 Total Test cases error is :" + RunReport.p2Error.ToString());
                LogMessageToFile("P2 Total Test cases other is :" + RunReport.p2Other.ToString());

                LogMessageToFile("P3 Total Test cases passed is :" + RunReport.p3Passed.ToString());
                LogMessageToFile("P3 Total Test cases failed is :" + RunReport.p3Failed.ToString());
                LogMessageToFile("P3 Total Test cases blocked is :" + RunReport.p3Blocked.ToString());
                LogMessageToFile("P3 Total Test cases active is :" + RunReport.p3Active.ToString());
                LogMessageToFile("P3 Total Test cases inconclusive is :" + RunReport.p3Inconclusive.ToString());
                LogMessageToFile("P3 Total Test cases aborted is :" + RunReport.p3Aborted.ToString());
                LogMessageToFile("P3 Total Test cases error is :" + RunReport.p3Error.ToString());
                LogMessageToFile("P3 Total Test cases other is :" + RunReport.p3Other.ToString());

                Console.WriteLine("Done");
            }
            catch (Exception exe)
            {
                return(false);
            }
            return(true);
        }