コード例 #1
0
        private static void PostExecutionEvents()
        {
            try
            {
                if ((ConfigFile.order == 0))
                {
                    try
                    {
                        EmailNotification.SendEmail();
                    }
                    catch (Exception e)
                    {
                        LogMessageToFile("The exception caused at the post execution block while sending email. The exception is : " + e.Message);
                    }
                }
            }
            catch//catch if order is not mentioned
            {
                try
                {
                    EmailNotification.SendEmail();
                }
                catch (Exception e)
                {
                    LogMessageToFile("The exception caused at the post execution block while sending email. The exception is : " + e.Message);
                }
            }
            if (testExecutionFailureOutcome == true)
            {
                LogMessageToFile("Test Failure Outcome was True");
                XML.GenerateForFailure(0, sp, "O");

                try
                {
                    //if (ConfigFile.type.ToUpper() == "CONTROLLER")
                    if (ConfigFile.order == 0)
                    {
                        ReportToSplunk();
                    }
                }
                catch
                { ReportToSplunk(); }

                ResetSplunkVariables();

                int k = 1;
                while (testExecutionFailureOutcome == true)
                {
                    ProjectCustomization.ReRunCustomization();
                    ExecutionBlock();
                    k++;
                    if (k == ConfigFile.retryAttemptForFailure)
                    {
                        break;
                    }
                }
            }
            else
            {
                //if (ConfigFile.type.ToUpper() == "CONTROLLER")
                if (ConfigFile.order == 0)
                {
                    ReportToSplunk();
                }
            }
            LogMessageToFile("Session Ended");
            LogMessageToFile("------------------------------------------------------------------");
        }
コード例 #2
0
        private static void ExecutionValidation()
        {
            string type = "CONTROLLER";

            try
            {
                if (ConfigFile.order != 0)
                {
                    type = "EXECUTOR";
                }
            }
            catch (Exception e)
            {
                type = "CONTROLLER";
            }
            testExecutionFailureOutcome = XML.ReadGeneratedSplogFileAndAssertOutcome(XML.combinedPath);

            if (ConfigFile.waitForReRun)
            {
                if (ConfigFile.splitRun || ConfigFile.distribute)
                {
                    switch (type)
                    {
                    case "CONTROLLER":
                        for (int i = 1; i <= ConfigFile.systems - 1; i++)
                        {
                            if (ConfigFile.splitRun != true)
                            {
                                TFSFunctions.WaitForExecutor(i);
                            }
                            else
                            {
                                TFSFunctions.WaitForExecutor(i, true);
                            }
                        }
                        break;

                    case "EXECUTOR":
                        if (ConfigFile.splitRun != true)
                        {
                            TFSFunctions.WaitForController();
                        }
                        else
                        {
                            TFSFunctions.WaitForController(true);
                        }
                        break;

                    default:
                        break;
                    }
                }
            }

            int runOutcome = TFSFunctions.EvaluateResultFromTFS(sp.curRunId);

            if (runOutcome == 2 || runOutcome == 3)
            {
                ProjectCustomization.ReRunCustomization();
                LogMessageToFile("RunOutcome was " + runOutcome.ToString());
            }
            CollectResultsAfterReRun();
        }