// fix public override void ActionEnd(uint eventTime, Act action, bool offlineMode = false) { // if user set special action log in output if (action.EnableActionLogConfig) { if (mGingerRunnerLogger == null) { string loggerFile = Path.Combine(mExecutionLogger.ExecutionLogfolder, FileSystem.AppendTimeStamp("GingerLog.txt")); mGingerRunnerLogger = new GingerRunnerLogger(loggerFile); } mGingerRunnerLogger.LogAction(action); } Activity currentActivity = null; try { string executionLogFolder = string.Empty; //if offline mode then execution logger path exists in action object so making executionLogFolder empty to avoid duplication of path. if (!offlineMode) { executionLogFolder = mExecutionLogger.ExecutionLogfolder; } //ActionReport AR = new ActionReport(action, mContext); //if action call the Shared actvity then mContext.Activity and mCurrentActivity will be different,so keeping the shared activity in temp variable if (mContext.Activity != mCurrentActivity) { currentActivity = mContext.Activity; } mContext.Activity = mCurrentActivity; Object AR = null; if (this.Configuration.ExecutionLoggerConfigurationIsEnabled) { AR = mExecutionLogger.SetReportAction(action, mContext, this.ExecutedFrom, offlineMode); // // Defects Suggestion section (to be considered to remove to separate function) // if (action.Status == Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed) { if (WorkSpace.Instance.RunsetExecutor.DefectSuggestionsList.Where(z => z.FailedActionGuid == action.Guid).ToList().Count > 0) { return; } // ActivitiesGroup currrentGroup = mContext.BusinessFlow.ActivitiesGroups.Where(x => x.Name == mCurrentActivity.ActivitiesGroupID).FirstOrDefault(); string currrentGroupName = string.Empty; if (currrentGroup != null) { currrentGroupName = currrentGroup.Name; } // List <string> screenShotsPathes = new List <string>(); bool isScreenshotButtonEnabled = false; if ((action.ScreenShots != null) && (action.ScreenShots.Count > 0)) { screenShotsPathes = action.ScreenShots.ToList(); isScreenshotButtonEnabled = true; } // bool automatedOpeningFlag = false; if (action.FlowControls.Where(x => x.FlowControlAction == eFlowControlAction.FailureIsAutoOpenedDefect && action.Status == Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed).ToList().Count > 0) { automatedOpeningFlag = true; } // OMG !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // StringBuilder description = new StringBuilder(); description.Append("<html><body><b>" + this.GingerData.GingerName + "<b><br>"); description.Append("<div><ul style='list - style - type:circle'><li><b>" + mContext.BusinessFlow.Name + " (failed)<b></li>"); if (currrentGroupName != string.Empty) { description.Append("<ul style = 'list - style - type:square'>"); this.mCurrentBusinessFlow.ActivitiesGroups.ToList().TakeWhile(x => x.Name != mCurrentActivity.ActivitiesGroupID).ToList().ForEach(r => { description.Append("<li>" + r.Name + "</li>"); }); description.Append("<li><b>" + currrentGroupName + " (failed)<b></li>"); description.Append("<ul style = 'list - style - type:upper-roman'>"); this.mCurrentBusinessFlow.Activities.Where(x => currrentGroup.ActivitiesIdentifiers.Select(z => z.ActivityGuid).ToList().Contains(x.Guid)).ToList().TakeWhile(x => x.Guid != mCurrentActivity.Guid).ToList().ForEach(r => { description.Append("<li>" + r.ActivityName + "</li>"); }); description.Append("<li><b>" + mCurrentActivity.ActivityName + " (failed)<b></li>"); description.Append("<ul style = 'list - style - type:disc'>"); mCurrentActivity.Acts.TakeWhile(x => x.Guid != action.Guid).ToList().ForEach(r => { description.Append("<li>" + r.Description + "</li>"); }); description.Append("<li><b><font color='#ff0000'b>" + action.Description + " (failed)</font><b></li></li></li></li></ul></ul></ul></ul></div></body></html>"); } else { description.Append("<ul style = 'list - style - type:upper-roman'>"); mContext.BusinessFlow.Activities.TakeWhile(x => x.Guid != mCurrentActivity.Guid).ToList().ForEach(r => { description.Append("<li>" + r.ActivityName + "</li>"); }); description.Append("<li><b>" + mCurrentActivity.ActivityName + " (failed)<b></li>"); description.Append("<ul style = 'list - style - type:disc'>"); mCurrentActivity.Acts.TakeWhile(x => x.Guid != action.Guid).ToList().ForEach(r => { description.Append("<li>" + r.Description + "</li>"); }); description.Append("<li><b><font color='#ff0000'b>" + action.Description + " (failed)</font><b></li></li></li></li></ul></ul></ul></div></body></html>"); } if (GingerData.GingerName == null) { GingerData.GingerName = ""; } WorkSpace.Instance.RunsetExecutor.DefectSuggestionsList.Add(new DefectSuggestion(action.Guid, this.GingerData.GingerName, mContext.BusinessFlow.Name, currrentGroupName, mContext.BusinessFlow.ExecutionLogActivityCounter, mCurrentActivity.ActivityName, mCurrentActivity.ExecutionLogActionCounter, action.Description, action.RetryMechanismCount, action.Error, action.ExInfo, screenShotsPathes, isScreenshotButtonEnabled, automatedOpeningFlag, description.ToString())); } // // Defects Suggestion section - end // } if (!offlineMode) { ExecutionProgressReporterListener.AddExecutionDetailsToLog(ExecutionProgressReporterListener.eExecutionPhase.End, "Action", string.Format("{0} (ID:{1}, ParentID:{2})", action.Description, action.Guid, action.ExecutionParentGuid), AR); } } catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, "Exception occurred in ExecutionLogger Action end", ex); } finally { if (currentActivity != null) { mContext.Activity = currentActivity; } } }