Exemplo n.º 1
0
        public RunSetConfig CreteRunsetWithOperations()
        {
            RunSetConfig runSetConfig = new RunSetConfig();

            runSetConfig.GingerRunners.Add(mGR);
            runSetConfig.mRunModeParallel = false;

            //added HTMl send mail action
            RunSetActionHTMLReportSendEmail sendMail = new RunSetActionHTMLReportSendEmail();

            sendMail.Condition         = RunSetActionBase.eRunSetActionCondition.AlwaysRun;
            sendMail.RunAt             = RunSetActionBase.eRunAt.ExecutionEnd;
            sendMail.MailFrom          = "*****@*****.**";
            sendMail.MailTo            = "*****@*****.**";
            sendMail.Email.EmailMethod = GingerCore.GeneralLib.Email.eEmailMethod.OUTLOOK;
            sendMail.Active            = true;

            //added Produce Html action

            RunSetActionHTMLReport produceHTML = CreateProduceHTMlOperation();

            //added JSON action
            RunSetActionJSONSummary jsonReportOperation = new RunSetActionJSONSummary();

            jsonReportOperation.Name      = "Json Report";
            jsonReportOperation.RunAt     = RunSetActionBase.eRunAt.ExecutionEnd;
            jsonReportOperation.Condition = RunSetActionBase.eRunSetActionCondition.AlwaysRun;
            jsonReportOperation.Active    = true;

            runSetConfig.RunSetActions.Add(sendMail);
            runSetConfig.RunSetActions.Add(produceHTML);
            runSetConfig.RunSetActions.Add(jsonReportOperation);

            return(runSetConfig);
        }
        private void AddJSONSummary(object sender, RoutedEventArgs e)
        {
            RunSetActionJSONSummary runSetActionJSONSummary = new RunSetActionJSONSummary();

            runSetActionJSONSummary.Name  = runSetActionJSONSummary.Type;
            runSetActionJSONSummary.RunAt = RunSetActionBase.eRunAt.ExecutionEnd;
            mRunSetConfig.RunSetActions.Add(runSetActionJSONSummary);
            RunSetActionsGrid.Grid.SelectedItem = runSetActionJSONSummary;
        }
Exemplo n.º 3
0
        public void JsonOperationTest()
        {
            //Arrange
            ObservableList <BusinessFlow> bfList = SR.GetAllRepositoryItems <BusinessFlow>();
            BusinessFlow BF1 = bfList[0];
            ObservableList <Activity> activityList = BF1.Activities;

            BF1.Active = true;
            GingerExecutionEngine mGRForRunset = new GingerExecutionEngine(new GingerRunner());

            mGRForRunset.GingerRunner.Name = "Test Runner";
            Agent a = new Agent();

            a.DriverType = Agent.eDriverType.SeleniumChrome;
            mGRForRunset.SolutionAgents = new ObservableList <Agent>();
            mGRForRunset.SolutionAgents.Add(a);
            mGRForRunset.GingerRunner.ApplicationAgents.Add(new ApplicationAgent()
            {
                AppName = "SCM", Agent = a
            });
            mGRForRunset.SolutionApplications = new ObservableList <ApplicationPlatform>();
            mGRForRunset.SolutionApplications.Add(new ApplicationPlatform()
            {
                AppName = "SCM", Platform = ePlatformType.Web, Description = "New application"
            });
            mGRForRunset.BusinessFlows.Add(BF1);
            WorkSpace.Instance.SolutionRepository             = SR;
            mGRForRunset.GingerRunner.SpecificEnvironmentName = environment.Name;
            mGRForRunset.GingerRunner.UseSpecificEnvironment  = false;
            RunSetConfig runSetConfig1 = new RunSetConfig();

            mGRForRunset.IsUpdateBusinessFlowRunList = true;
            runSetConfig1.GingerRunners.Add(mGRForRunset.GingerRunner);
            runSetConfig1.UpdateRunnersBusinessFlowRunsList();
            runSetConfig1.mRunModeParallel = false;
            RunSetActionJSONSummary jsonAction = CreateJsonOperation();

            runSetConfig1.RunSetActions.Add(jsonAction);
            RunsetExecutor GMR1 = new RunsetExecutor();

            GMR1.RunsetExecutionEnvironment = environment;
            GMR1.RunSetConfig = runSetConfig1;
            WorkSpace.Instance.RunsetExecutor = GMR1;

            //Act
            GMR1.RunSetConfig.RunSetActions[0].runSetActionBaseOperations.ExecuteWithRunPageBFES();

            //Assert
            Assert.AreEqual(GMR1.RunSetConfig.RunSetActions[0].Status, RunSetActionBase.eRunSetActionStatus.Completed);
        }
Exemplo n.º 4
0
        public RunSetActionJSONSummary CreateJsonOperation()
        {
            //added JSON action
            RunSetActionJSONSummary jsonReportOperation = new RunSetActionJSONSummary();

            jsonReportOperation.Name      = "Json Report";
            jsonReportOperation.RunAt     = RunSetActionBase.eRunAt.ExecutionEnd;
            jsonReportOperation.Condition = RunSetActionBase.eRunSetActionCondition.AlwaysRun;
            jsonReportOperation.Active    = true;

            RunSetActionJSONSummaryOperations runSetActionJSONSummaryOperations = new RunSetActionJSONSummaryOperations(jsonReportOperation);

            jsonReportOperation.RunSetActionJSONSummaryOperations = runSetActionJSONSummaryOperations;

            RunSetActionBaseOperations runSetActionBaseOperations = new RunSetActionBaseOperations(jsonReportOperation);

            jsonReportOperation.runSetActionBaseOperations = runSetActionBaseOperations;
            return(jsonReportOperation);
        }
        public static void CreateRealRunSetFromDynamic(RunsetExecutor runsetExecutor, AddRunset dynamicRunset)
        {
            RunSetConfig runSetConfig = new RunSetConfig();

            runSetConfig.Name            = dynamicRunset.Name;
            runSetConfig.RunWithAnalyzer = dynamicRunset.RunAnalyzer;
            runSetConfig.RunModeParallel = dynamicRunset.RunInParallel;

            // Add runners
            foreach (AddRunner addRunner in dynamicRunset.AddRunners)
            {
                GingerRunner gingerRunner = new GingerRunner();
                gingerRunner.Name = addRunner.Name;

                if (!string.IsNullOrEmpty(addRunner.RunMode))
                {
                    gingerRunner.RunOption = (GingerRunner.eRunOptions)Enum.Parse(typeof(GingerRunner.eRunOptions), addRunner.RunMode, true);
                }

                if (!string.IsNullOrEmpty(addRunner.Environment))
                {
                    gingerRunner.UseSpecificEnvironment  = true;
                    gingerRunner.SpecificEnvironmentName = addRunner.Environment;
                }

                //add Agents
                foreach (SetAgent setAgent in addRunner.SetAgents)
                {
                    ApplicationAgent appAgent = new ApplicationAgent();
                    appAgent.AppName   = setAgent.ApplicationName;
                    appAgent.AgentName = setAgent.AgentName;
                    gingerRunner.ApplicationAgents.Add(appAgent);
                }

                // Add BFs
                foreach (AddBusinessFlow addBusinessFlow in addRunner.AddBusinessFlows)
                {
                    BusinessFlowRun businessFlowRun = new BusinessFlowRun();
                    businessFlowRun.BusinessFlowName     = addBusinessFlow.Name;
                    businessFlowRun.BusinessFlowIsActive = true;

                    // set BF Variables
                    if (addBusinessFlow.InputVariables != null)
                    {
                        foreach (InputVariable inputVariabel in addBusinessFlow.InputVariables)
                        {
                            businessFlowRun.BusinessFlowCustomizedRunVariables.Add(new VariableString()
                            {
                                DiffrentFromOrigin = true, VarValChanged = true, ParentType = inputVariabel.VariableParentType, ParentName = inputVariabel.VariableParentName, Name = inputVariabel.VariableName, InitialStringValue = inputVariabel.VariableValue, Value = inputVariabel.VariableValue
                            });
                        }
                    }
                    gingerRunner.BusinessFlowsRunList.Add(businessFlowRun);
                }
                runSetConfig.GingerRunners.Add(gingerRunner);
            }

            //Add mail Report handling
            foreach (AddRunsetOperation addOperation in dynamicRunset.AddRunsetOperations)
            {
                if (addOperation is MailReport)
                {
                    MailReport dynamicMailOperation = (MailReport)addOperation;
                    RunSetActionHTMLReportSendEmail mailOperation = new RunSetActionHTMLReportSendEmail();

                    mailOperation.Name      = "Dynamic Mail Report";
                    mailOperation.Condition = (RunSetActionBase.eRunSetActionCondition)Enum.Parse(typeof(RunSetActionBase.eRunSetActionCondition), dynamicMailOperation.Condition, true);
                    mailOperation.RunAt     = (RunSetActionBase.eRunAt)Enum.Parse(typeof(RunSetActionBase.eRunAt), dynamicMailOperation.RunAt, true);
                    mailOperation.Active    = true;

                    mailOperation.MailFrom = dynamicMailOperation.MailFrom;
                    mailOperation.MailTo   = dynamicMailOperation.MailTo;
                    mailOperation.MailCC   = dynamicMailOperation.MailCC;

                    mailOperation.Subject  = dynamicMailOperation.Subject;
                    mailOperation.Comments = dynamicMailOperation.Comments;
                    //mailOperation.Comments = string.Format("Dynamic {0} Execution Report" + GingerDicser.GetTermResValue(eTermResKey.RunSet));

                    mailOperation.HTMLReportTemplate           = RunSetActionHTMLReportSendEmail.eHTMLReportTemplate.HTMLReport;
                    mailOperation.selectedHTMLReportTemplateID = 100;//ID to mark defualt template

                    mailOperation.Email.IsBodyHTML  = true;
                    mailOperation.Email.EmailMethod = GingerCore.GeneralLib.Email.eEmailMethod.SMTP;
                    mailOperation.Email.MailFrom    = dynamicMailOperation.MailFrom;
                    mailOperation.Email.MailTo      = dynamicMailOperation.MailTo;
                    mailOperation.Email.Subject     = dynamicMailOperation.Subject;
                    if (dynamicMailOperation.SendViaOutlook)
                    {
                        mailOperation.Email.EmailMethod = GingerCore.GeneralLib.Email.eEmailMethod.OUTLOOK;
                    }
                    else
                    {
                        if (dynamicMailOperation.SmtpDetails != null)
                        {
                            mailOperation.Email.EmailMethod  = GingerCore.GeneralLib.Email.eEmailMethod.SMTP;
                            mailOperation.Email.SMTPMailHost = dynamicMailOperation.SmtpDetails.Server;
                            mailOperation.Email.SMTPPort     = int.Parse(dynamicMailOperation.SmtpDetails.Port);
                            mailOperation.Email.EnableSSL    = bool.Parse(dynamicMailOperation.SmtpDetails.EnableSSL);
                            if (string.IsNullOrEmpty(dynamicMailOperation.SmtpDetails.User) == false)
                            {
                                mailOperation.Email.ConfigureCredential = true;
                                mailOperation.Email.SMTPUser            = dynamicMailOperation.SmtpDetails.User;
                                mailOperation.Email.SMTPPass            = dynamicMailOperation.SmtpDetails.Password;
                            }
                        }
                    }

                    if (dynamicMailOperation.IncludeAttachmentReport)
                    {
                        EmailHtmlReportAttachment reportAttachment = new EmailHtmlReportAttachment();
                        reportAttachment.AttachmentType = EmailAttachment.eAttachmentType.Report;
                        reportAttachment.ZipIt          = true;
                        mailOperation.EmailAttachments.Add(reportAttachment);
                    }

                    runSetConfig.RunSetActions.Add(mailOperation);
                }
                else if (addOperation is JsonReport)
                {
                    JsonReport dynamicJsonReport = (JsonReport)addOperation;
                    RunSetActionJSONSummary jsonReportOperation = new RunSetActionJSONSummary();

                    jsonReportOperation.Name      = "Dynamic Json Report";
                    jsonReportOperation.Condition = (RunSetActionBase.eRunSetActionCondition)Enum.Parse(typeof(RunSetActionBase.eRunSetActionCondition), dynamicJsonReport.Condition, true);
                    jsonReportOperation.RunAt     = (RunSetActionBase.eRunAt)Enum.Parse(typeof(RunSetActionBase.eRunAt), dynamicJsonReport.RunAt, true);
                    jsonReportOperation.Active    = true;

                    runSetConfig.RunSetActions.Add(jsonReportOperation);
                }
            }

            // Set config
            runsetExecutor.RunSetConfig = runSetConfig;
        }
Exemplo n.º 6
0
        public RunSetActionSummaryJSONPage(RunSetActionJSONSummary runSetActionJSONSummary)
        {
            InitializeComponent();

            mRunSetActionJSONSummary = runSetActionJSONSummary;
        }