Example #1
0
        public static AccountReportBusinessFlow MapBusinessFlowStartData(BusinessFlow businessFlow, Context context)
        {
            businessFlow.ExecutionId       = Guid.NewGuid();
            businessFlow.ParentExecutionId = context.Runner.ExecutionId;

            AccountReportBusinessFlow accountReportBusinessFlow = new AccountReportBusinessFlow();

            accountReportBusinessFlow.Id       = businessFlow.ExecutionId;
            accountReportBusinessFlow.EntityId = businessFlow.Guid;
            accountReportBusinessFlow.AccountReportDbRunnerId = businessFlow.ParentExecutionId;
            accountReportBusinessFlow.ExecutionId             = (Guid)WorkSpace.Instance.RunsetExecutor.RunSetConfig.ExecutionID;
            accountReportBusinessFlow.Seq                         = context.Runner.ExecutionLogBusinessFlowsCounter + 1;
            accountReportBusinessFlow.InstanceGUID                = businessFlow.InstanceGuid;
            accountReportBusinessFlow.Name                        = businessFlow.Name;
            accountReportBusinessFlow.Description                 = businessFlow.Description;
            accountReportBusinessFlow.RunDescription              = GetCalculatedValue(context, businessFlow.RunDescription);
            accountReportBusinessFlow.Environment                 = ((GingerExecutionEngine)context.Runner).GingerRunner.ProjEnvironment.Name;
            accountReportBusinessFlow.EnvironmentId               = ((GingerExecutionEngine)context.Runner).GingerRunner.ProjEnvironment.Guid;
            accountReportBusinessFlow.StartTimeStamp              = businessFlow.StartTimeStamp;
            accountReportBusinessFlow.VariablesBeforeExec         = businessFlow.Variables.Select(a => a.Name + "_:_" + a.Value + "_:_" + a.Description + "_:_" + a.Guid + "_:_" + a.SetAsInputValue + "_:_" + a.SetAsOutputValue + "_:_" + a.Publish).ToList();
            accountReportBusinessFlow.SolutionVariablesBeforeExec = businessFlow.GetSolutionVariables().Select(a => a.Name + "_:_" + a.Value + "_:_" + a.Description).ToList();
            accountReportBusinessFlow.RunStatus                   = _InProgressStatus;
            accountReportBusinessFlow.IsPublished                 = businessFlow.Publish;
            int    ChildExecutableItemsCountAction = 0;
            string Actions   = HTMLReportConfiguration.eExecutionStatisticsCountBy.Actions.ToString();
            string Actvities = HTMLReportConfiguration.eExecutionStatisticsCountBy.Activities.ToString();

            foreach (Activity activity in businessFlow.Activities)
            {
                ChildExecutableItemsCountAction = ChildExecutableItemsCountAction + activity.Acts.Count(x => x.Active == true);
            }
            accountReportBusinessFlow.ChildExecutableItemsCount = new List <AccountReport.Contracts.Helpers.DictObject>();
            accountReportBusinessFlow.ChildExecutableItemsCount.Add(new AccountReport.Contracts.Helpers.DictObject
            {
                Key = Actvities, Value = businessFlow.Activities.Count(x => x.Active == true)
            });

            accountReportBusinessFlow.ChildExecutableItemsCount.Add(new AccountReport.Contracts.Helpers.DictObject
            {
                Key = Actions, Value = ChildExecutableItemsCountAction
            });
            return(accountReportBusinessFlow);
        }
Example #2
0
        public override void BusinessFlowStart(uint eventTime, BusinessFlow businessFlow, bool ContinueRun = false)
        {
            mCurrentBusinessFlow = businessFlow;
            if (this.Configuration.ExecutionLoggerConfigurationIsEnabled)
            {
                this.BFCounter++;
                string BFFolder = string.Empty;
                this.ExecutionLogBusinessFlowsCounter++;
                mExecutionLogger.ExecutionLogBusinessFlowsCounter++;
                switch (this.ExecutedFrom)
                {
                case Amdocs.Ginger.Common.eExecutedFrom.Automation:
                    //if (Configuration.ExecutionLoggerAutomationTabContext == ExecutionLoggerConfiguration.AutomationTabContext.BussinessFlowRun) // Not Sure why it is added, not working at some points, removing it for now
                    //{
                    mExecutionLogger.ExecutionLogfolder = executionLoggerHelper.GetLoggerDirectory(mExecutionLogger.ExecutionLogfolder);
                    executionLoggerHelper.CleanDirectory(mExecutionLogger.ExecutionLogfolder);
                    // }

                    break;

                case Amdocs.Ginger.Common.eExecutedFrom.Run:
                    if (ContinueRun == false)
                    {
                        BFFolder = BFCounter + " " + folderNameNormalazing(businessFlow.Name);
                    }
                    break;

                default:
                    BFFolder = BFCounter + " " + folderNameNormalazing(businessFlow.Name);
                    break;
                }
                businessFlow.VariablesBeforeExec         = businessFlow.Variables.Select(a => a.Name + "_:_" + a.Value + "_:_" + a.Description).ToList();
                businessFlow.SolutionVariablesBeforeExec = businessFlow.GetSolutionVariables().Select(a => a.Name + "_:_" + a.Value + "_:_" + a.Description).ToList();
                businessFlow.ExecutionLogFolder          = BFFolder;
                mExecutionLogger.CreateNewDirectory(Path.Combine(Configuration.CalculatedLoggerFolder, BFFolder));

                ExecutionProgressReporterListener.AddExecutionDetailsToLog(ExecutionProgressReporterListener.eExecutionPhase.Start, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), businessFlow.Name, null);
            }
        }
Example #3
0
        public static AccountReportBusinessFlow MapBusinessFlowEndData(BusinessFlow businessFlow, Context context)
        {
            AccountReportBusinessFlow accountReportBusinessFlow = new AccountReportBusinessFlow();

            accountReportBusinessFlow.Id       = businessFlow.ExecutionId;
            accountReportBusinessFlow.EntityId = businessFlow.Guid;
            accountReportBusinessFlow.AccountReportDbRunnerId = businessFlow.ParentExecutionId;
            accountReportBusinessFlow.ExecutionId             = (Guid)WorkSpace.Instance.RunsetExecutor.RunSetConfig.ExecutionID;
            accountReportBusinessFlow.Name                       = businessFlow.Name;
            accountReportBusinessFlow.EndTimeStamp               = businessFlow.EndTimeStamp;
            accountReportBusinessFlow.ElapsedEndTimeStamp        = businessFlow.Elapsed;
            accountReportBusinessFlow.RunStatus                  = businessFlow.RunStatus.ToString();
            accountReportBusinessFlow.VariablesAfterExec         = businessFlow.Variables.Select(a => a.Name + "_:_" + a.Value + "_:_" + a.Description + "_:_" + a.Guid + "_:_" + a.SetAsInputValue + "_:_" + a.SetAsOutputValue + "_:_" + a.Publish).ToList();
            accountReportBusinessFlow.SolutionVariablesAfterExec = businessFlow.GetSolutionVariables().Select(a => a.Name + "_:_" + a.Value + "_:_" + a.Description).ToList();;
            accountReportBusinessFlow.BFFlowControlDT            = businessFlow.BFFlowControls.Select(a => a.Condition + "_:_" + a.ConditionCalculated + "_:_" + a.BusinessFlowControlAction + "_:_" + a.Status).ToList();;
            accountReportBusinessFlow.AutomationPercent          = businessFlow.AutomationPrecentage;
            int ChildExecutableItemsCountAction = 0;
            int ChildExecutedItemsCountAction   = 0;
            int ChildPassedItemsCountAction     = 0;

            foreach (Activity activity in businessFlow.Activities)
            {
                ChildExecutableItemsCountAction = ChildExecutableItemsCountAction + activity.Acts.Count(x => x.Active == true);
                ChildExecutedItemsCountAction   = ChildExecutedItemsCountAction + activity.Acts.Count(x => x.Status == eRunStatus.Passed || x.Status == eRunStatus.Failed || x.Status == eRunStatus.FailIgnored || x.Status == eRunStatus.Stopped || x.Status == eRunStatus.Completed);
                ChildPassedItemsCountAction     = ChildPassedItemsCountAction + activity.Acts.Count(x => x.Status == eRunStatus.Passed);
            }
            string Actvities = HTMLReportConfiguration.eExecutionStatisticsCountBy.Activities.ToString();
            string Actions   = HTMLReportConfiguration.eExecutionStatisticsCountBy.Actions.ToString();

            accountReportBusinessFlow.ChildExecutableItemsCount = new List <AccountReport.Contracts.Helpers.DictObject>();
            accountReportBusinessFlow.ChildExecutableItemsCount.Add(new AccountReport.Contracts.Helpers.DictObject
            {
                Key = Actvities, Value = businessFlow.Activities.Count(x => x.Active == true)
            });

            accountReportBusinessFlow.ChildExecutedItemsCount = new List <AccountReport.Contracts.Helpers.DictObject>();
            accountReportBusinessFlow.ChildExecutedItemsCount.Add(new AccountReport.Contracts.Helpers.DictObject
            {
                Key = Actvities, Value = businessFlow.Activities.Where(ac => ac.Status == eRunStatus.Failed || ac.Status == eRunStatus.Passed || ac.Status == eRunStatus.FailIgnored || ac.Status == eRunStatus.Stopped || ac.Status == eRunStatus.Completed).Count()
            });

            accountReportBusinessFlow.ChildPassedItemsCount = new List <AccountReport.Contracts.Helpers.DictObject>();
            accountReportBusinessFlow.ChildPassedItemsCount.Add(new AccountReport.Contracts.Helpers.DictObject
            {
                Key = Actvities, Value = businessFlow.Activities.Where(ac => ac.Status == eRunStatus.Passed).Count()
            });


            accountReportBusinessFlow.ChildExecutableItemsCount.Add(new AccountReport.Contracts.Helpers.DictObject
            {
                Key = Actions, Value = ChildExecutableItemsCountAction
            });

            accountReportBusinessFlow.ChildExecutedItemsCount.Add(new AccountReport.Contracts.Helpers.DictObject
            {
                Key = Actions, Value = ChildExecutedItemsCountAction
            });

            accountReportBusinessFlow.ChildPassedItemsCount.Add(new AccountReport.Contracts.Helpers.DictObject
            {
                Key = Actions, Value = ChildPassedItemsCountAction
            });

            accountReportBusinessFlow.ExecutionRate = string.Format("{0:F1}", CalculateExecutionOrPassRate(accountReportBusinessFlow.ChildExecutedItemsCount[(int)_HTMLReportConfig.ExecutionStatisticsCountBy].Value, accountReportBusinessFlow.ChildExecutableItemsCount[(int)_HTMLReportConfig.ExecutionStatisticsCountBy].Value));

            accountReportBusinessFlow.PassRate = string.Format("{0:F1}", CalculateExecutionOrPassRate(accountReportBusinessFlow.ChildPassedItemsCount[(int)_HTMLReportConfig.ExecutionStatisticsCountBy].Value, accountReportBusinessFlow.ChildExecutedItemsCount[(int)_HTMLReportConfig.ExecutionStatisticsCountBy].Value));
            return(accountReportBusinessFlow);
        }