public static AccountReportRunner MapRunnerStartData(GingerRunner gingerRunner, Context context) { gingerRunner.Executor.ExecutionId = Guid.NewGuid(); if (WorkSpace.Instance.RunsetExecutor.RunSetConfig.ExecutionID != null) { gingerRunner.Executor.ParentExecutionId = (Guid)WorkSpace.Instance.RunsetExecutor.RunSetConfig.ExecutionID; } AccountReportRunner accountReportRunner = new AccountReportRunner(); accountReportRunner.Id = gingerRunner.Executor.ExecutionId; accountReportRunner.EntityId = gingerRunner.Guid; accountReportRunner.AccountReportDbRunSetId = gingerRunner.Executor.ParentExecutionId; accountReportRunner.ExecutionId = (Guid)WorkSpace.Instance.RunsetExecutor.RunSetConfig.ExecutionID; accountReportRunner.Seq = gingerRunner.Executor.ExecutionLoggerManager.GingerData.Seq; accountReportRunner.Name = gingerRunner.Name; //accountReportRunner.Description = gingerRunner.Description; accountReportRunner.Environment = gingerRunner.ProjEnvironment.Name.ToString(); accountReportRunner.EnvironmentId = gingerRunner.ProjEnvironment.Guid; accountReportRunner.StartTimeStamp = gingerRunner.Executor.StartTimeStamp; accountReportRunner.ApplicationAgentsMappingList = gingerRunner.ApplicationAgents.Select(a => a.AgentName + "_:_" + a.AppName).ToList(); SetRunnerChildCounts((GingerExecutionEngine)gingerRunner.Executor, accountReportRunner); accountReportRunner.RunStatus = _InProgressStatus; accountReportRunner.IsPublished = gingerRunner.Publish; return(accountReportRunner); }
public static AccountReportRunner MapRunnerEndData(GingerRunner gingerRunner, Context context) { AccountReportRunner accountReportRunner = new AccountReportRunner(); accountReportRunner.Id = gingerRunner.Executor.ExecutionId; accountReportRunner.Name = gingerRunner.Name; accountReportRunner.EntityId = gingerRunner.Guid; accountReportRunner.AccountReportDbRunSetId = gingerRunner.Executor.ParentExecutionId; accountReportRunner.ExecutionId = (Guid)WorkSpace.Instance.RunsetExecutor.RunSetConfig.ExecutionID; accountReportRunner.Name = gingerRunner.Name; accountReportRunner.ElapsedEndTimeStamp = gingerRunner.Executor.Elapsed; accountReportRunner.EndTimeStamp = gingerRunner.Executor.EndTimeStamp; //accountReportRunner.RunStatus = gingerRunner.Status.ToString();//SetStatus(BusinessFlowsColl); // check if need to calculate based on businessflows status data accountReportRunner.RunStatus = GetRunnerStatus((GingerExecutionEngine)gingerRunner.Executor).ToString(); SetRunnerChildCounts((GingerExecutionEngine)gingerRunner.Executor, accountReportRunner); accountReportRunner.ExecutionRate = string.Format("{0:F1}", CalculateExecutionOrPassRate(accountReportRunner.ChildExecutedItemsCount[(int)_HTMLReportConfig.ExecutionStatisticsCountBy].Value, accountReportRunner.ChildExecutableItemsCount[(int)_HTMLReportConfig.ExecutionStatisticsCountBy].Value)); accountReportRunner.PassRate = string.Format("{0:F1}", CalculateExecutionOrPassRate(accountReportRunner.ChildPassedItemsCount[(int)_HTMLReportConfig.ExecutionStatisticsCountBy].Value, accountReportRunner.ChildExecutedItemsCount[(int)_HTMLReportConfig.ExecutionStatisticsCountBy].Value)); return(accountReportRunner); }
public async Task SendRunnerExecutionDataToCentralDBAsync(AccountReportRunner accountReportRunner, bool isUpdate = false) { if (restClient != null) { string message = string.Format("execution data to Central DB for the Runner:'{0}' (Execution Id:'{1}', Parent Execution Id:'{2}')", accountReportRunner.Name, accountReportRunner.Id, accountReportRunner.AccountReportDbRunSetId); try { bool responseIsSuccess = await SendRestRequestAndGetResponse(SEND_RUNNER_EXECUTION_DATA, accountReportRunner, isUpdate).ConfigureAwait(false); if (responseIsSuccess) { Reporter.ToLog(eLogLevel.DEBUG, "Successfully sent " + message); } else { Reporter.ToLog(eLogLevel.ERROR, "Failed to send " + message); } } catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, "Exception when sending " + message, ex); } } }
private async Task RunnerRunStartTask(GingerRunner gingerRunner) { AccountReportRunner accountReportRunner = AccountReportEntitiesDataMapping.MapRunnerStartData(gingerRunner, mContext); await AccountReportApiHandler.SendRunnerExecutionDataToCentralDBAsync(accountReportRunner); }
private async Task RunnerRunEndTask(GingerExecutionEngine gingerRunner) { AccountReportRunner accountReportRunner = AccountReportEntitiesDataMapping.MapRunnerEndData(gingerRunner.GingerRunner, mContext); await AccountReportApiHandler.SendRunnerExecutionDataToCentralDBAsync(accountReportRunner, true); }
private static void SetRunnerChildCounts(GingerExecutionEngine runner, AccountReportRunner accountReportRunner) { int ChildExecutableItemsCountActivity = 0; int ChildExecutedItemsCountActivity = 0; int ChildPassedItemsCountActivity = 0; int ChildExecutableItemsCountAction = 0; int ChildExecutedItemsCountAction = 0; int ChildPassedItemsCountAction = 0; string Actvities = HTMLReportConfiguration.eExecutionStatisticsCountBy.Activities.ToString(); string Actions = HTMLReportConfiguration.eExecutionStatisticsCountBy.Actions.ToString(); foreach (BusinessFlow businessFlow in runner.BusinessFlows) { int count = 0; ChildExecutableItemsCountActivity = ChildExecutableItemsCountActivity + businessFlow.Activities.Count(x => x.Active == true); ChildExecutedItemsCountActivity = ChildExecutedItemsCountActivity + 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(); ChildPassedItemsCountActivity = ChildPassedItemsCountActivity + businessFlow.Activities.Where(ac => ac.Status == eRunStatus.Passed).Count(); 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 = activity.Acts.Count(x => x.Status == eRunStatus.Passed); } } accountReportRunner.ChildExecutableItemsCount = new List <AccountReport.Contracts.Helpers.DictObject>(); accountReportRunner.ChildExecutableItemsCount.Add(new AccountReport.Contracts.Helpers.DictObject { Key = Actvities, Value = ChildExecutableItemsCountActivity }); accountReportRunner.ChildExecutedItemsCount = new List <AccountReport.Contracts.Helpers.DictObject>(); accountReportRunner.ChildExecutedItemsCount.Add(new AccountReport.Contracts.Helpers.DictObject { Key = Actvities, Value = ChildExecutedItemsCountActivity }); accountReportRunner.ChildPassedItemsCount = new List <AccountReport.Contracts.Helpers.DictObject>(); accountReportRunner.ChildPassedItemsCount.Add(new AccountReport.Contracts.Helpers.DictObject { Key = Actvities, Value = ChildPassedItemsCountActivity }); accountReportRunner.ChildExecutableItemsCount.Add(new AccountReport.Contracts.Helpers.DictObject { Key = Actions, Value = ChildExecutableItemsCountAction }); accountReportRunner.ChildExecutedItemsCount.Add(new AccountReport.Contracts.Helpers.DictObject { Key = Actions, Value = ChildExecutedItemsCountAction }); accountReportRunner.ChildPassedItemsCount.Add(new AccountReport.Contracts.Helpers.DictObject { Key = Actions, Value = ChildPassedItemsCountAction }); }