public override bool ExportBusinessFlowToALM(BusinessFlow businessFlow, bool performSaveAfterExport = false, ALMIntegration.eALMConnectType almConectStyle = ALMIntegration.eALMConnectType.Manual, string testPlanUploadPath = null, string testLabUploadPath = null) { if (businessFlow == null) { return(false); } if (businessFlow.ActivitiesGroups.Count == 0) { Reporter.ToUser(eUserMsgKey.StaticInfoMessage, "The " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " do not include " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroups) + " which supposed to be mapped to ALM Test Cases, please add at least one " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup) + " before doing export."); return(false); } bool exportRes; string res = string.Empty; Reporter.ToStatus(eStatusMsgKey.ExportItemToALM, null, businessFlow.Name); exportRes = ((RallyCore)ALMIntegration.Instance.AlmCore).ExportBusinessFlowToRally(businessFlow, WorkSpace.Instance.Solution.ExternalItemsFields, ref res); if (exportRes) { if (performSaveAfterExport) { Reporter.ToStatus(eStatusMsgKey.SaveItem, null, businessFlow.Name, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow)); WorkSpace.Instance.SolutionRepository.SaveRepositoryItem(businessFlow); } if (almConectStyle != ALMIntegration.eALMConnectType.Auto && almConectStyle != ALMIntegration.eALMConnectType.Silence) { Reporter.ToUser(eUserMsgKey.ExportItemToALMSucceed); } } else { if (almConectStyle != ALMIntegration.eALMConnectType.Silence) { Reporter.ToUser(eUserMsgKey.ExportItemToALMFailed, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), businessFlow.Name, res); } } Reporter.HideStatusMessage(); return(exportRes); }
public void RunRunset(bool doContinueRun = false) { List <Task> runnersTasks = new List <Task>(); //reset run if (doContinueRun == false) { RunSetConfig.LastRunsetLoggerFolder = "-1"; Reporter.ToLog(eLogLevel.INFO, string.Format("Reseting {0} elements", GingerDicser.GetTermResValue(eTermResKey.RunSet))); mStopwatch.Reset(); ResetRunnersExecutionDetails(); } else { RunSetConfig.LastRunsetLoggerFolder = null; } mStopRun = false; //configure Runners for run Reporter.ToLog(eLogLevel.INFO, string.Format("Configurating {0} elements for execution", GingerDicser.GetTermResValue(eTermResKey.RunSet))); ConfigureAllRunnersForExecution(); //Process all pre execution Run Set Operations if (doContinueRun == false) { Reporter.ToLog(eLogLevel.INFO, string.Format("Running Pre-Execution {0} Operations", GingerDicser.GetTermResValue(eTermResKey.RunSet))); App.MainWindow.Dispatcher.Invoke(() => //ToDO: Remove dependency on UI thread- it should run in backend { App.RunsetExecutor.ProcessRunSetActions(new List <RunSetActionBase.eRunAt> { RunSetActionBase.eRunAt.ExecutionStart, RunSetActionBase.eRunAt.DuringExecution }); }); } //Start Run if (doContinueRun == false) { Reporter.ToLog(eLogLevel.INFO, string.Format("########################## Starting {0} Execution", GingerDicser.GetTermResValue(eTermResKey.RunSet))); SetRunnersExecutionLoggerConfigs();//contains ExecutionLogger.RunSetStart() } else { Reporter.ToLog(eLogLevel.INFO, string.Format("########################## Continue {0} Execution", GingerDicser.GetTermResValue(eTermResKey.RunSet))); } mStopwatch.Start(); if (RunSetConfig.RunModeParallel) { //running parallel foreach (GingerRunner GR in Runners) { if (mStopRun) { return; } Task t = new Task(() => { if (doContinueRun == false) { GR.RunRunner(); } else if (GR.Status == Amdocs.Ginger.CoreNET.Execution.eRunStatus.Stopped) //we continue only Stopped Runners { GR.ResetRunnerExecutionDetails(doNotResetBusFlows: true); //reset stopped runners only and not their BF's GR.ContinueRun(GingerRunner.eContinueLevel.Runner, GingerRunner.eContinueFrom.LastStoppedAction); } }, TaskCreationOptions.LongRunning); runnersTasks.Add(t); t.Start(); // Wait one second before starting another runner Thread.Sleep(1000); } } else { //running sequentially Task t = new Task(() => { foreach (GingerRunner GR in Runners) { if (mStopRun) { return; } if (doContinueRun == false) { GR.RunRunner(); } else if (GR.Status == Amdocs.Ginger.CoreNET.Execution.eRunStatus.Stopped) //we continue only Stopped Runners { GR.ResetRunnerExecutionDetails(doNotResetBusFlows: true); //reset stopped runners only and not their BF's GR.ContinueRun(GingerRunner.eContinueLevel.Runner, GingerRunner.eContinueFrom.LastStoppedAction); } else if (GR.Status == Amdocs.Ginger.CoreNET.Execution.eRunStatus.Pending) //continue the runners flow { GR.RunRunner(); } // Wait one second before starting another runner Thread.Sleep(1000); } }, TaskCreationOptions.LongRunning); runnersTasks.Add(t); t.Start(); } //Wait till end of run when all tasks are completed int count = 0; while (count < runnersTasks.Count) //removing dependency on stop because all Runners needs to stop first before exit { Thread.Sleep(100); count = (from x in runnersTasks where x.IsCompleted select x).Count(); } mStopwatch.Stop(); //Do post execution items Reporter.ToLog(eLogLevel.INFO, string.Format("######## {0} Runners Execution Ended", GingerDicser.GetTermResValue(eTermResKey.RunSet))); Ginger.Run.ExecutionLogger.RunSetEnd(); if (mStopRun == false) { // Process all post execution RunSet Operations Reporter.ToLog(eLogLevel.INFO, string.Format("######## Running Post-Execution {0} Operations", GingerDicser.GetTermResValue(eTermResKey.RunSet))); App.MainWindow.Dispatcher.Invoke(() => //ToDO: Remove dependency on UI thread- it should run in backend { App.RunsetExecutor.ProcessRunSetActions(new List <RunSetActionBase.eRunAt> { RunSetActionBase.eRunAt.ExecutionEnd }); }); } Reporter.ToLog(eLogLevel.INFO, string.Format("######## Doing {0} Execution Cleanup", GingerDicser.GetTermResValue(eTermResKey.RunSet))); CreateGingerExecutionReportAutomaticly(); CloseAllEnvironments(); Reporter.ToLog(eLogLevel.INFO, string.Format("########################## {0} Execution Ended", GingerDicser.GetTermResValue(eTermResKey.RunSet))); }
private bool ProcessCommandLineArgs() { // New option with one arg to config file // resole spaces and quotes mess in commnd arg + more user friednly to edit // We expect only AutoRun --> File location try { string[] Args = Environment.GetCommandLineArgs(); // We xpect Autorun as arg[1] string[] arg1 = Args[1].Split('='); if (arg1[0] != "ConfigFile") { Reporter.ToLog(eLogLevel.ERROR, "'ConfigFile' argument was not found."); return(false); } string AutoRunFileName = arg1[1]; Reporter.ToLog(eLogLevel.INFO, "Reading all arguments from the Config file placed at: '" + AutoRunFileName + "'"); string[] lines = System.IO.File.ReadAllLines(AutoRunFileName); string scURL = null; string scUser = null; string scPswd = null; foreach (string arg in lines) { int i = arg.IndexOf('='); string param = arg.Substring(0, i).Trim(); string value = arg.Substring(i + 1).Trim(); switch (param) { case "SourceControlType": Reporter.ToLogAndConsole(eLogLevel.INFO, "Selected SourceControlType: '" + value + "'"); if (value.Equals("GIT")) { App.UserProfile.SourceControlType = SourceControlBase.eSourceControlType.GIT; } else if (value.Equals("SVN")) { App.UserProfile.SourceControlType = SourceControlBase.eSourceControlType.SVN; } else { App.UserProfile.SourceControlType = SourceControlBase.eSourceControlType.None; } break; case "SourceControlUrl": Reporter.ToLogAndConsole(eLogLevel.INFO, "Selected SourceControlUrl: '" + value + "'"); if (App.UserProfile.SourceControlType == SourceControlBase.eSourceControlType.SVN) { if (!value.ToUpper().Contains("/SVN") && !value.ToUpper().Contains("/SVN/")) { value = value + "svn/"; } if (!value.ToUpper().EndsWith("/")) { value = value + "/"; } } App.UserProfile.SourceControlURL = value; scURL = value; break; case "SourceControlUser": Reporter.ToLogAndConsole(eLogLevel.INFO, "Selected SourceControlUser: '******'"); if (App.UserProfile.SourceControlType == SourceControlBase.eSourceControlType.GIT && value == "") { value = "Test"; } App.UserProfile.SourceControlUser = value; scUser = value; break; case "SourceControlPassword": Reporter.ToLogAndConsole(eLogLevel.INFO, "Selected SourceControlPassword: '******'"); App.UserProfile.SourceControlPass = value; scPswd = value; break; case "PasswordEncrypted": Reporter.ToLogAndConsole(eLogLevel.INFO, "PasswordEncrypted: '" + value + "'"); string pswd = App.UserProfile.SourceControlPass; if (value == "Y") { pswd = EncryptionHandler.DecryptwithKey(App.UserProfile.SourceControlPass, App.ENCRYPTION_KEY); } if (App.UserProfile.SourceControlType == SourceControlBase.eSourceControlType.GIT && pswd == "") { pswd = "Test"; } App.UserProfile.SourceControlPass = pswd; break; case "SourceControlProxyServer": Reporter.ToLogAndConsole(eLogLevel.INFO, "Selected SourceControlProxyServer: '" + value + "'"); if (value == "") { App.UserProfile.SolutionSourceControlConfigureProxy = false; } else { App.UserProfile.SolutionSourceControlConfigureProxy = true; } if (value != "" && !value.ToUpper().StartsWith("HTTP://")) { value = "http://" + value; } App.UserProfile.SolutionSourceControlProxyAddress = value; break; case "SourceControlProxyPort": if (value == "") { App.UserProfile.SolutionSourceControlConfigureProxy = false; } else { App.UserProfile.SolutionSourceControlConfigureProxy = true; } Reporter.ToLogAndConsole(eLogLevel.INFO, "Selected SourceControlProxyPort: '" + value + "'"); App.UserProfile.SolutionSourceControlProxyPort = value; break; case "Solution": if (scURL != null && scUser != "" && scPswd != null) { Reporter.ToLogAndConsole(eLogLevel.INFO, "Downloading Solution from source control"); if (value.IndexOf(".git") != -1) { App.DownloadSolution(value.Substring(0, value.IndexOf(".git") + 4)); } else { App.DownloadSolution(value); } } Reporter.ToLog(eLogLevel.INFO, "Loading the Solution: '" + value + "'"); try { if (App.SetSolution(value) == false) { Reporter.ToLog(eLogLevel.ERROR, "Failed to load the Solution"); return(false); } } catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, "Failed to load the Solution"); Reporter.ToLog(eLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {ex.Message}"); return(false); } break; case "Env": Reporter.ToLog(eLogLevel.INFO, "Selected Environment: '" + value + "'"); ProjEnvironment env = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <ProjEnvironment>().Where(x => x.Name.ToLower().Trim() == value.ToLower().Trim()).FirstOrDefault(); if (env != null) { RunsetExecutionEnvironment = env; } else { Reporter.ToLog(eLogLevel.ERROR, "Failed to find matching Environment in the Solution"); return(false); } break; case "RunSet": Reporter.ToLog(eLogLevel.INFO, string.Format("Selected {0}: '{1}'", GingerDicser.GetTermResValue(eTermResKey.RunSet), value)); RunSetConfig runSetConfig = App.LocalRepository.GetSolutionRunSets().Where(x => x.Name.ToLower().Trim() == value.ToLower().Trim()).FirstOrDefault(); if (runSetConfig != null) { App.RunsetExecutor.RunSetConfig = runSetConfig; } else { Reporter.ToLog(eLogLevel.ERROR, string.Format("Failed to find matching {0} in the Solution", GingerDicser.GetTermResValue(eTermResKey.RunSet))); return(false); } break; default: Reporter.ToLog(eLogLevel.ERROR, "Un Known argument: '" + param + "'"); return(false); } } if (RunSetConfig != null && RunsetExecutionEnvironment != null) { return(true); } else { Reporter.ToLog(eLogLevel.ERROR, "Missing key arguments which required for execution"); return(false); } } catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, "Exception occurred during command line arguments processing", ex); return(false); } }
public void RunRunset(bool doContinueRun = false) { try { mRunSetConfig.IsRunning = true; //reset run if (doContinueRun == false) { if (WorkSpace.Instance.RunningInExecutionMode == false || RunSetConfig.ExecutionID == null) { RunSetConfig.ExecutionID = Guid.NewGuid(); } RunSetConfig.LastRunsetLoggerFolder = "-1"; // !!!!!!!!!!!!!!!!!! Reporter.ToLog(eLogLevel.INFO, string.Format("Reseting {0} elements", GingerDicser.GetTermResValue(eTermResKey.RunSet))); mStopwatch.Reset(); ResetRunnersExecutionDetails(); } else { RunSetConfig.LastRunsetLoggerFolder = null; } mStopRun = false; //configure Runners for run Reporter.ToLog(eLogLevel.INFO, string.Format("Configuring {0} elements for execution", GingerDicser.GetTermResValue(eTermResKey.RunSet))); ConfigureAllRunnersForExecution(); //Process all pre execution Run Set Operations if (doContinueRun == false) { Reporter.ToLog(eLogLevel.INFO, string.Format("Running Pre-Execution {0} Operations", GingerDicser.GetTermResValue(eTermResKey.RunSet))); WorkSpace.Instance.RunsetExecutor.ProcessRunSetActions(new List <RunSetActionBase.eRunAt> { RunSetActionBase.eRunAt.ExecutionStart, RunSetActionBase.eRunAt.DuringExecution }); } //Start Run if (doContinueRun == false) { Reporter.ToLog(eLogLevel.INFO, string.Format("########################## {0} Execution Started: '{1}'", GingerDicser.GetTermResValue(eTermResKey.RunSet), RunSetConfig.Name)); SetRunnersExecutionLoggerConfigs();//contains ExecutionLogger.RunSetStart() } else { Reporter.ToLog(eLogLevel.INFO, string.Format("########################## {0} Execution Continuation: '{1}'", GingerDicser.GetTermResValue(eTermResKey.RunSet), RunSetConfig.Name)); } mStopwatch.Start(); Reporter.ToLog(eLogLevel.INFO, string.Format("######## {0} Runners Execution Started", GingerDicser.GetTermResValue(eTermResKey.RunSet))); List <Task> runnersTasks = new List <Task>(); if (RunSetConfig.RunModeParallel) { foreach (GingerRunner GR in Runners) { if (mStopRun) { return; } Task t = new Task(() => { if (doContinueRun == false) { GR.RunRunner(); } else if (GR.Status == Amdocs.Ginger.CoreNET.Execution.eRunStatus.Stopped) //we continue only Stopped Runners { GR.ResetRunnerExecutionDetails(doNotResetBusFlows: true); //reset stopped runners only and not their BF's GR.ContinueRun(eContinueLevel.Runner, eContinueFrom.LastStoppedAction); } }, TaskCreationOptions.LongRunning); runnersTasks.Add(t); t.Start(); // Wait one second before starting another runner Thread.Sleep(1000); } } else { //running sequentially Task t = new Task(() => { foreach (GingerRunner GR in Runners) { if (mStopRun) { return; } if (doContinueRun == false) { GR.RunRunner(); } else if (GR.Status == Amdocs.Ginger.CoreNET.Execution.eRunStatus.Stopped) //we continue only Stopped Runners { GR.ResetRunnerExecutionDetails(doNotResetBusFlows: true); //reset stopped runners only and not their BF's GR.ContinueRun(eContinueLevel.Runner, eContinueFrom.LastStoppedAction); } else if (GR.Status == Amdocs.Ginger.CoreNET.Execution.eRunStatus.Pending)//continue the runners flow { GR.RunRunner(); } // Wait one second before starting another runner Thread.Sleep(1000); } }, TaskCreationOptions.LongRunning); runnersTasks.Add(t); t.Start(); } Task.WaitAll(runnersTasks.ToArray()); mStopwatch.Stop(); //Do post execution items Reporter.ToLog(eLogLevel.INFO, string.Format("######## {0} Runners Execution Ended", GingerDicser.GetTermResValue(eTermResKey.RunSet))); //ExecutionLoggerManager.RunSetEnd(); Runners[0].ExecutionLoggerManager.RunSetEnd(); if (mStopRun == false) { // Process all post execution RunSet Operations Reporter.ToLog(eLogLevel.INFO, string.Format("######## Running Post-Execution {0} Operations", GingerDicser.GetTermResValue(eTermResKey.RunSet))); WorkSpace.Instance.RunsetExecutor.ProcessRunSetActions(new List <RunSetActionBase.eRunAt> { RunSetActionBase.eRunAt.ExecutionEnd }); } Reporter.ToLog(eLogLevel.INFO, string.Format("######## Creating {0} Execution Report", GingerDicser.GetTermResValue(eTermResKey.RunSet))); CreateGingerExecutionReportAutomaticly(); Reporter.ToLog(eLogLevel.INFO, string.Format("######## Doing {0} Execution Cleanup", GingerDicser.GetTermResValue(eTermResKey.RunSet))); CloseAllEnvironments(); Reporter.ToLog(eLogLevel.INFO, string.Format("########################## {0} Execution Ended", GingerDicser.GetTermResValue(eTermResKey.RunSet))); } finally { mRunSetConfig.IsRunning = false; } }
private void SetActivitiesGridView() { //Columns View //# Default View GridViewDef defView = new GridViewDef(GridViewDef.DefaultViewName); defView.GridColsView = new ObservableList <GridColView>(); defView.GridColsView.Add(new GridColView() { Field = nameof(RepositoryItemBase.ItemImageType), Header = " ", StyleType = GridColView.eGridColStyleType.ImageMaker, WidthWeight = 2.5, MaxWidth = 20 }); defView.GridColsView.Add(new GridColView() { Field = nameof(RepositoryItemBase.SharedRepoInstanceImage), Header = "S.R.", StyleType = GridColView.eGridColStyleType.ImageMaker, WidthWeight = 2.5, MaxWidth = 20 }); defView.GridColsView.Add(new GridColView() { Field = Activity.Fields.Active, WidthWeight = 2.5, MaxWidth = 50, StyleType = GridColView.eGridColStyleType.Template, CellTemplate = (DataTemplate)this.mainGrdActivities.Resources["FieldActive"] }); defView.GridColsView.Add(new GridColView() { Field = Activity.Fields.Mandatory, Header = "Mand.", WidthWeight = 3.0, MaxWidth = 50, StyleType = GridColView.eGridColStyleType.CheckBox }); defView.GridColsView.Add(new GridColView() { Field = Activity.Fields.ActivityName, WidthWeight = 15, Header = "Name", StyleType = GridColView.eGridColStyleType.Template, CellTemplate = (DataTemplate)this.mainGrdActivities.Resources["FieldName"] }); defView.GridColsView.Add(new GridColView() { Field = Activity.Fields.Description, WidthWeight = 10 }); defView.GridColsView.Add(new GridColView() { Field = Activity.Fields.TargetApplication, WidthWeight = 7.5, Header = "T. Application" }); defView.GridColsView.Add(new GridColView() { Field = Activity.Fields.ActivitiesGroupID, Header = GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup), WidthWeight = 7.5, ReadOnly = true }); defView.GridColsView.Add(new GridColView() { Field = Activity.Fields.VariablesNames, Header = GingerDicser.GetTermResValue(eTermResKey.Variables), WidthWeight = 7.5, BindingMode = BindingMode.OneWay }); List <string> automationStatusList = GingerCore.General.GetEnumValues(typeof(Activity.eActivityAutomationStatus)); defView.GridColsView.Add(new GridColView() { Field = Activity.Fields.AutomationStatus, WidthWeight = 6, Header = "Auto. Status", StyleType = GridColView.eGridColStyleType.ComboBox, CellValuesList = automationStatusList }); List <GingerCore.General.ComboEnumItem> runOptionList = GingerCore.General.GetEnumValuesForCombo(typeof(Activity.eActionRunOption)); defView.GridColsView.Add(new GridColView() { Field = Activity.Fields.ActionRunOption, WidthWeight = 10, Header = "Actions Run Option", StyleType = GridColView.eGridColStyleType.ComboBox, CellValuesList = runOptionList }); defView.GridColsView.Add(new GridColView() { Field = Activity.Fields.Status, WidthWeight = 6, Header = "Run Status", BindingMode = BindingMode.OneWay, PropertyConverter = (new ColumnPropertyConverter(new ActivityStatusConverter(), TextBlock.ForegroundProperty)) }); defView.GridColsView.Add(new GridColView() { Field = Activity.Fields.ElapsedSecs, WidthWeight = 6, Header = "Elapsed", BindingMode = BindingMode.OneWay, HorizontalAlignment = System.Windows.HorizontalAlignment.Right }); grdActivities.SetAllColumnsDefaultView(defView); //# Custom Views GridViewDef desView = new GridViewDef(eAutomatePageViewStyles.Design.ToString()); desView.GridColsView = new ObservableList <GridColView>(); desView.GridColsView.Add(new GridColView() { Field = Activity.Fields.Status, Visible = false }); desView.GridColsView.Add(new GridColView() { Field = Activity.Fields.ElapsedSecs, Visible = false }); grdActivities.AddCustomView(desView); GridViewDef execView = new GridViewDef(eAutomatePageViewStyles.Execution.ToString()); execView.GridColsView = new ObservableList <GridColView>(); execView.GridColsView.Add(new GridColView() { Field = Activity.Fields.VariablesNames, Visible = false }); execView.GridColsView.Add(new GridColView() { Field = Activity.Fields.AutomationStatus, Visible = false }); grdActivities.AddCustomView(execView); grdActivities.InitViewItems(); //Tool bar grdActivities.btnMarkAll.Visibility = Visibility.Visible; grdActivities.btnEdit.AddHandler(Button.ClickEvent, new RoutedEventHandler(EditActivity)); grdActivities.btnAdd.AddHandler(Button.ClickEvent, new RoutedEventHandler(AddActivity)); grdActivities.ShowCopyCutPast = System.Windows.Visibility.Visible; grdActivities.ShowTagsFilter = Visibility.Visible; grdActivities.btnRefresh.AddHandler(Button.ClickEvent, new RoutedEventHandler(RefreshActivitiesGridHandler)); grdActivities.AddToolbarTool("@Handler_16x16.png", "Add Error Handler", new RoutedEventHandler(AddErrorHandler)); grdActivities.AddToolbarTool("@RoadSign_16x16.png", "Set " + GingerDicser.GetTermResValue(eTermResKey.Activities) + "-" + GingerDicser.GetTermResValue(eTermResKey.Variables) + " Dependencies", new RoutedEventHandler(LoadActivitiesVariablesDependenciesPage)); grdActivities.AddToolbarTool("@Group_16x16.png", GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroups) + " Manager", new RoutedEventHandler(LoadActivitiesGroupsManagr)); grdActivities.AddToolbarTool("@UploadStar_16x16.png", "Add to Shared Repository", new RoutedEventHandler(AddToRepository)); grdActivities.AddToolbarTool(eImageType.Reset, "Reset Run Details", new RoutedEventHandler(ResetActivity)); //Events grdActivities.RowChangedEvent += grdActivities_RowChangedEvent; grdActivities.RowDoubleClick += grdActivities_grdMain_MouseDoubleClick; grdActivities.ItemDropped += grdActivities_ItemDropped; grdActivities.PreviewDragItem += grdActivities_PreviewDragItem; grdActivities.MarkUnMarkAllActive += MarkUnMarkAllActivities; }
public bool ExportBusinessFlowToRQM(BusinessFlow businessFlow, ObservableList <ExternalItemFieldBase> ExternalItemsFields, ref string result) { mExternalItemsFields = ExternalItemsFields; LoginDTO loginData = new LoginDTO() { User = ALMCore.DefaultAlmConfig.ALMUserName, Password = ALMCore.DefaultAlmConfig.ALMPassword, Server = ALMCore.DefaultAlmConfig.ALMServerURL }; //ActivityPlan is TestPlan in RQM and BusinessFlow in Ginger List <IActivityPlan> testPlanList = new List <IActivityPlan>(); //1 ActivityPlan testPlan = GetTestPlanFromBusinessFlow(businessFlow); testPlanList.Add(testPlan);//2 if (businessFlow.ActivitiesGroups.Count == 0) { throw new Exception(GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " must have at least one " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup)); } ResultInfo resultInfo; try { //Create (RQM)TestCase for each Ginger ActivityGroup and add it to RQM TestCase List testPlan.Activities = new List <IActivityModel>();//3 foreach (ActivitiesGroup ag in businessFlow.ActivitiesGroups) { testPlan.Activities.Add(GetTestCaseFromActivityGroup(ag)); } RQMConnect.Instance.RQMRep.GetConection(); resultInfo = RQMConnect.Instance.RQMRep.ExportTestPlan(loginData, testPlanList, ALMCore.DefaultAlmConfig.ALMServerURL, RQMCore.ALMProjectGuid, ALMCore.DefaultAlmConfig.ALMProjectName, RQMCore.ALMProjectGroupName, null); } catch (Exception ex) { result = "Failed to export the " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " to RQM/ALM " + ex.Message; Reporter.ToLog(eLogLevel.ERROR, "Failed to export the " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " to RQM/ALM", ex); return(false); } // Deal with response from RQM after export // 0 = sucsess , 1 = failed if (resultInfo.ErrorCode == 0) { foreach (ActivityPlan plan in testPlanList) { businessFlow.ExternalID = "RQMID=" + plan.ExportedID.ToString(); int ActivityGroupCounter = 0; int activityStepCounter = 0; int activityStepOrderID = 1; foreach (ACL_Data_Contract.Activity act in plan.Activities) { string ActivityGroupID = "RQMID=" + act.ExportedID.ToString() + "|RQMScriptID=" + act.ExportedTestScriptId.ToString() + "|RQMRecordID=" + act.ExportedTcExecutionRecId.ToString() + "|AtsID=" + act.EntityId.ToString(); businessFlow.ActivitiesGroups[ActivityGroupCounter].ExternalID = ActivityGroupID; foreach (ACL_Data_Contract.ActivityStep activityStep in act.ActivityData.ActivityStepsColl) { //string activityStepID = "RQMID=" + activityStepOrderID.ToString() + "|AtsID=" + act.EntityId.ToString(); string activityStepID = "RQMID=" + act.ExportedTestScriptId.ToString() + "_" + activityStepOrderID + "|AtsID=" + act.EntityId.ToString(); businessFlow.Activities[activityStepCounter].ExternalID = activityStepID; activityStepCounter++; activityStepOrderID++; } activityStepOrderID = 0; ActivityGroupCounter++; } } return(true); } else { result = "Failed to export the " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " to RQM/ALM, " + resultInfo.ErrorDesc; Reporter.ToLog(eLogLevel.ERROR, "Failed to export the " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " to RQM/ALM, " + resultInfo.ErrorDesc); return(false); } }
public void SaveSolution(bool showWarning = true, eSolutionItemToSave solutionItemToSave = eSolutionItemToSave.GeneralDetails) { bool doSave = false; if (!showWarning) { doSave = true; } else { Solution lastSavedSolution = LoadSolution(FilePath, false); string extraChangedItems = ""; StringBuilder bldExtraChangedItems = new StringBuilder(); if (solutionItemToSave != eSolutionItemToSave.GeneralDetails) { if (this.Name != lastSavedSolution.Name || this.Account != lastSavedSolution.Account) { bldExtraChangedItems.Append("Solution General Details, "); } } if (solutionItemToSave != eSolutionItemToSave.ALMSettings) { if (this.ALMDomain != lastSavedSolution.ALMDomain || this.ALMProject != lastSavedSolution.ALMProject || this.ALMServerURL != lastSavedSolution.ALMServerURL || this.AlmType != lastSavedSolution.AlmType) { bldExtraChangedItems.Append("ALM Details, "); } } if (solutionItemToSave != eSolutionItemToSave.SourceControlSettings) { if (this.SourceControl != lastSavedSolution.SourceControl) { bldExtraChangedItems.Append("Source Control Details, "); } } if (solutionItemToSave != eSolutionItemToSave.ReportsSettings) { if (ExecutionLoggerConfigurationSetList != null && (ExecutionLoggerConfigurationSetList.Count != lastSavedSolution.ExecutionLoggerConfigurationSetList.Count || HTMLReportsConfigurationSetList.Count != lastSavedSolution.HTMLReportsConfigurationSetList.Count)) { bldExtraChangedItems.Append("Reports Settings, "); } else { if (ExecutionLoggerConfigurationSetList != null) { foreach (ExecutionLoggerConfiguration config in ExecutionLoggerConfigurationSetList) { if (config.DirtyStatus == Amdocs.Ginger.Common.Enums.eDirtyStatus.Modified || config.DirtyStatus == Amdocs.Ginger.Common.Enums.eDirtyStatus.NoTracked) { bldExtraChangedItems.Append("Reports Settings, "); break; } } } if (!bldExtraChangedItems.ToString().Contains("Reports Settings")) { foreach (HTMLReportsConfiguration config in HTMLReportsConfigurationSetList) { if (config.DirtyStatus == Amdocs.Ginger.Common.Enums.eDirtyStatus.Modified || config.DirtyStatus == Amdocs.Ginger.Common.Enums.eDirtyStatus.NoTracked) { bldExtraChangedItems.Append("Reports Settings, "); break; } } } } } if (solutionItemToSave != eSolutionItemToSave.GlobalVariabels) { if (Variables.Count != lastSavedSolution.Variables.Count) { bldExtraChangedItems.Append(GingerDicser.GetTermResValue(eTermResKey.Variables, "Global ", ", ")); } else { foreach (VariableBase var in Variables) { if (var.DirtyStatus == Amdocs.Ginger.Common.Enums.eDirtyStatus.Modified || var.DirtyStatus == Amdocs.Ginger.Common.Enums.eDirtyStatus.NoTracked) { bldExtraChangedItems.Append(GingerDicser.GetTermResValue(eTermResKey.Variables, "Global ", ", ")); break; } } } } if (solutionItemToSave != eSolutionItemToSave.TargetApplications) { if (ApplicationPlatforms.Count != lastSavedSolution.ApplicationPlatforms.Count) { bldExtraChangedItems.Append("Target Applications, "); } else { foreach (ApplicationPlatform app in ApplicationPlatforms) { if (app.DirtyStatus == Amdocs.Ginger.Common.Enums.eDirtyStatus.Modified || app.DirtyStatus == Amdocs.Ginger.Common.Enums.eDirtyStatus.NoTracked) { bldExtraChangedItems.Append("Target Applications, "); break; } } } } if (solutionItemToSave != eSolutionItemToSave.Tags) { if (Tags.Count != lastSavedSolution.Tags.Count) { bldExtraChangedItems.Append("Tags, "); } else { foreach (RepositoryItemTag tag in Tags) { if (tag.DirtyStatus == Amdocs.Ginger.Common.Enums.eDirtyStatus.Modified || tag.DirtyStatus == Amdocs.Ginger.Common.Enums.eDirtyStatus.NoTracked) { bldExtraChangedItems.Append("Tags, "); break; } } } } extraChangedItems = bldExtraChangedItems.ToString(); if (string.IsNullOrEmpty(extraChangedItems)) { doSave = true; } else { extraChangedItems = extraChangedItems.TrimEnd(); extraChangedItems = extraChangedItems.TrimEnd(new char[] { ',' }); if (Reporter.ToUser(eUserMsgKeys.SolutionSaveWarning, extraChangedItems) == System.Windows.MessageBoxResult.Yes) { doSave = true; } } } if (doSave) { Reporter.ToGingerHelper(eGingerHelperMsgKey.SaveItem, null, "Solution Configurations", "item"); RepositorySerializer.SaveToFile(this, FilePath); this.SetDirtyStatusToNoChange(); Reporter.CloseGingerHelper(); } }
public override bool ExportBusinessFlowToALM(BusinessFlow businessFlow, bool performSaveAfterExport = false, ALMIntegration.eALMConnectType almConectStyle = ALMIntegration.eALMConnectType.Manual, string testPlanUploadPath = null, string testLabUploadPath = null) { bool result = false; string responseStr = string.Empty; if (businessFlow != null) { if (businessFlow.ActivitiesGroups.Count == 0) { Reporter.ToUser(eUserMsgKey.StaticInfoMessage, "The " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " do not include " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroups) + " which supposed to be mapped to ALM Test Cases, please add at least one " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup) + " before doing export."); return(false); } else { ObservableList <ExternalItemFieldBase> allFields = new ObservableList <ExternalItemFieldBase>(WorkSpace.Instance.Solution.ExternalItemsFields); ALMIntegration.Instance.RefreshALMItemFields(allFields, true, null); var testCaseFields = allFields.Where(a => a.ItemType == (ResourceType.TEST_CASE.ToString()) && (a.ToUpdate || a.Mandatory)); var testSetFields = allFields.Where(a => a.ItemType == (ResourceType.TEST_SET.ToString()) && (a.ToUpdate || a.Mandatory)); var testExecutionFields = allFields.Where(a => a.ItemType == "TEST_EXECUTION" && (a.ToUpdate || a.Mandatory)); var exportRes = ((JiraCore)this.AlmCore).ExportBfToAlm(businessFlow, testCaseFields, testSetFields, testExecutionFields, ref responseStr); if (exportRes) { if (performSaveAfterExport) { Reporter.ToStatus(eStatusMsgKey.SaveItem, null, businessFlow.Name, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow)); WorkSpace.Instance.SolutionRepository.SaveRepositoryItem(businessFlow); Reporter.HideStatusMessage(); } if (almConectStyle != ALMIntegration.eALMConnectType.Auto) { Reporter.ToUser(eUserMsgKey.ExportItemToALMSucceed); } return(true); } else if (almConectStyle != ALMIntegration.eALMConnectType.Auto) { Reporter.ToUser(eUserMsgKey.ExportItemToALMFailed, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), businessFlow.Name, responseStr); } } } return(result); }
public override bool ExportActivitiesGroupToALM(ActivitiesGroup activtiesGroup, string uploadPath = null, bool performSaveAfterExport = false, BusinessFlow businessFlow = null) { bool result = false; string responseStr = string.Empty; if (activtiesGroup != null) { ObservableList <ExternalItemFieldBase> allFields = new ObservableList <ExternalItemFieldBase>(WorkSpace.Instance.Solution.ExternalItemsFields); var testCaseFields = allFields.Where(a => a.ItemType == ResourceType.TEST_CASE.ToString()); bool exportRes = ((JiraCore)this.AlmCore).ExportActivitiesGroupToALM(activtiesGroup, testCaseFields, ref responseStr); Reporter.HideStatusMessage(); if (exportRes) { if (performSaveAfterExport) { Reporter.ToStatus(eStatusMsgKey.SaveItem, null, activtiesGroup.Name, GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup)); WorkSpace.Instance.SolutionRepository.SaveRepositoryItem(activtiesGroup); Reporter.HideStatusMessage(); } Reporter.ToUser(eUserMsgKey.ExportItemToALMSucceed); return(true); } else { Reporter.ToUser(eUserMsgKey.ExportItemToALMFailed, GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup), activtiesGroup.Name, responseStr); } } return(result); }
private void FindUsages() { try { //TODO: check that retrieve also sub folder business flows ObservableList <BusinessFlow> BizFlows = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <BusinessFlow>(); foreach (BusinessFlow BF in BizFlows) { if (mRepoItem is Activity) { foreach (Activity a in BF.Activities) { if (a.ParentGuid == mRepoItem.Guid || a.Guid == mRepoItem.Guid || (mRepoItem.ExternalID != null && mRepoItem.ExternalID != string.Empty && mRepoItem.ExternalID != "0" && a.ExternalID == mRepoItem.ExternalID)) { //skip original if not needed if (!mIncludeOriginal) { if (a.Guid == mOriginalItem.Guid) { continue; } } Ginger.Repository.RepositoryItemUsage.eUsageTypes type; if (a.Guid == mRepoItem.Guid) { type = RepositoryItemUsage.eUsageTypes.Original; } else { type = RepositoryItemUsage.eUsageTypes.Instance; } RepositoryItemUsage itemUsage = new RepositoryItemUsage() { HostBusinessFlow = BF, HostBizFlowPath = Path.Combine(BF.ContainingFolder, BF.Name), UsageItem = a, UsageItemName = a.ActivityName, UsageExtraDetails = "Number of Actions: " + a.Acts.Count().ToString(), UsageItemType = type, Selected = true, Status = RepositoryItemUsage.eStatus.NotUpdated }; itemUsage.SetItemPartesFromEnum(typeof(eItemParts)); RepoItemUsages.Add(itemUsage); } } } else if (mRepoItem is ActivitiesGroup) { foreach (ActivitiesGroup a in BF.ActivitiesGroups) { if (a.ParentGuid == mRepoItem.Guid || a.Guid == mRepoItem.Guid || (mRepoItem.ExternalID != null && mRepoItem.ExternalID != string.Empty && mRepoItem.ExternalID != "0" && a.ExternalID == mRepoItem.ExternalID)) { //skip original if not needed if (!mIncludeOriginal) { if (a.Guid == mOriginalItem.Guid) { continue; } } Ginger.Repository.RepositoryItemUsage.eUsageTypes type; if (a.Guid == mRepoItem.Guid) { type = RepositoryItemUsage.eUsageTypes.Original; } else { type = RepositoryItemUsage.eUsageTypes.Instance; } RepositoryItemUsage itemUsage = new RepositoryItemUsage() { HostBusinessFlow = BF, HostBizFlowPath = Path.Combine(BF.ContainingFolder, BF.Name), UsageItem = a, UsageItemName = a.Name, UsageExtraDetails = "Number of " + GingerDicser.GetTermResValue(eTermResKey.Activities) + ": " + a.ActivitiesIdentifiers.Count().ToString(), UsageItemType = type, Selected = true, Status = RepositoryItemUsage.eStatus.NotUpdated }; itemUsage.SetItemPartesFromEnum(typeof(ActivitiesGroup.eItemParts)); RepoItemUsages.Add(itemUsage); } } } else if (mRepoItem is Act) { foreach (Activity activity in BF.Activities) { foreach (Act a in activity.Acts) { if (a.ParentGuid == mRepoItem.Guid || a.Guid == mRepoItem.Guid || (mRepoItem.ExternalID != null && mRepoItem.ExternalID != string.Empty && mRepoItem.ExternalID != "0" && a.ExternalID == mRepoItem.ExternalID)) { //skip original if not needed if (!mIncludeOriginal) { if (a.Guid == mOriginalItem.Guid) { continue; } } Ginger.Repository.RepositoryItemUsage.eUsageTypes type; if (a.Guid == mRepoItem.Guid) { type = RepositoryItemUsage.eUsageTypes.Original; } else { type = RepositoryItemUsage.eUsageTypes.Instance; } RepositoryItemUsage itemUsage = new RepositoryItemUsage() { HostBusinessFlow = BF, HostBizFlowPath = Path.Combine(BF.ContainingFolder, BF.Name), HostActivity = activity, HostActivityName = activity.ActivityName, UsageItem = a, UsageItemName = a.Description, UsageExtraDetails = "", UsageItemType = type, Selected = true, Status = RepositoryItemUsage.eStatus.NotUpdated }; itemUsage.SetItemPartesFromEnum(typeof(Act.eItemParts)); RepoItemUsages.Add(itemUsage); } } } } else if (mRepoItem is VariableBase) { //search on Bus Flow level foreach (VariableBase a in BF.Variables) { if (a.ParentGuid == mRepoItem.Guid || a.Guid == mRepoItem.Guid || (mRepoItem.ExternalID != null && mRepoItem.ExternalID != string.Empty && mRepoItem.ExternalID != "0" && a.ExternalID == mRepoItem.ExternalID)) { //skip original if not needed if (!mIncludeOriginal) { if (a.Guid == mOriginalItem.Guid) { continue; } } Ginger.Repository.RepositoryItemUsage.eUsageTypes type; if (a.Guid == mRepoItem.Guid) { type = RepositoryItemUsage.eUsageTypes.Original; } else { type = RepositoryItemUsage.eUsageTypes.Instance; } RepositoryItemUsage itemUsage = new RepositoryItemUsage() { HostBusinessFlow = BF, HostBizFlowPath = Path.Combine(BF.ContainingFolder, BF.Name), UsageItem = a, UsageItemName = a.Name, UsageExtraDetails = "Current Value: " + a.Value, UsageItemType = type, Selected = true, Status = RepositoryItemUsage.eStatus.NotUpdated }; itemUsage.SetItemPartesFromEnum(typeof(VariableBase.eItemParts)); RepoItemUsages.Add(itemUsage); } } //search on Activities level foreach (Activity activity in BF.Activities) { foreach (VariableBase a in activity.Variables) { if (a.ParentGuid == mRepoItem.Guid || a.Guid == mRepoItem.Guid || (mRepoItem.ExternalID != null && mRepoItem.ExternalID != string.Empty && mRepoItem.ExternalID != "0" && a.ExternalID == mRepoItem.ExternalID)) { //skip original if not needed if (!mIncludeOriginal) { if (a.Guid == mOriginalItem.Guid) { continue; } } Ginger.Repository.RepositoryItemUsage.eUsageTypes type; if (a.Guid == mRepoItem.Guid) { type = RepositoryItemUsage.eUsageTypes.Original; } else { type = RepositoryItemUsage.eUsageTypes.Instance; } RepositoryItemUsage itemUsage = new RepositoryItemUsage() { HostBusinessFlow = BF, HostBizFlowPath = Path.Combine(BF.ContainingFolder, BF.Name), HostActivity = activity, HostActivityName = activity.ActivityName, UsageItem = a, UsageItemName = a.Name, UsageExtraDetails = "Current Value: " + a.Value, UsageItemType = type, Selected = true, Status = RepositoryItemUsage.eStatus.NotUpdated }; itemUsage.SetItemPartesFromEnum(typeof(VariableBase.eItemParts)); RepoItemUsages.Add(itemUsage); } } } } } } catch (Exception ex) { Reporter.ToUser(eUserMsgKey.GetRepositoryItemUsagesFailed, mRepoItem.GetNameForFileName(), ex.Message); } }
public static List <AnalyzerItemBase> Analyze(BusinessFlow BusinessFlow, Activity parentActivity, Act a, ObservableList <DataSourceBase> DSList) { // Put all tests on Action here List <string> ActivityUsedVariables = new List <string>(); List <string> mUsedGlobalParameters = new List <string>(); List <string> mMissingStoreToGlobalParameters = new List <string>(); List <AnalyzerItemBase> IssuesList = new List <AnalyzerItemBase>(); ObservableList <GlobalAppModelParameter> mModelsGlobalParamsList = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <GlobalAppModelParameter>(); // Check if the action is obsolete and suggest conversion/upgrade/delete //if (a is IObsoleteAction) //{ // if (a.Active) // { // // TODO: get platform from activity in test // Platform.eType ActivitySourcePlatform = Platform.eType.AndroidDevice; //FIXME temp // // if it is active then create conversion issue // if (((IObsoleteAction)a).IsObsoleteForPlatform(ActivitySourcePlatform)) // { // AnalyzeAction AA = CreateNewIssue(IssuesList, BusinessFlow, Activity, a); // AA.Description = GingerDicser.GetTermResValue(eTermResKey.Activity) + " Contains Obsolete action"; ; // AA.Details = a.Description + " Old Class=" + a.ActClass; // AA.HowToFix = "Convert to new action"; // TODO: get name of new action // AA.CanAutoFix = AnalyzerItemBase.eCanFix.Yes; // AA.IssueType = eType.Warning; // AA.Impact = "New action can have more capabilities and more stable, good to upgrade"; // AA.Severity = eSeverity.Medium; // AA.FixItHandler = UpgradeAction; // AA.ActivitySourcePlatform = ActivitySourcePlatform; // } // } // else // { // // old action but not active so create issue of delete old unused action // AnalyzeAction AA = CreateNewIssue(IssuesList, BusinessFlow, Activity, a); // AA.Description = GingerDicser.GetTermResValue(eTermResKey.Activity) + " Contains Obsolete action which is not used"; ; // AA.Details = a.Description + " Old Class=" + a.ActClass; // AA.HowToFix = "Delete action"; // AA.CanAutoFix = AnalyzerItemBase.eCanFix.Yes; // AA.IssueType = eType.Warning; // AA.Impact = "slower execution, disk space"; // AA.Severity = eSeverity.Low; // AA.FixItHandler = DeleteAction; // } //} //Flow Control -> GoToAction , Check if Action u want to go to exist if (a.FlowControls.Count > 0) { foreach (GingerCore.FlowControlLib.FlowControl f in a.FlowControls) { if (f.Active == true) { if (f.FlowControlAction == eFlowControlAction.GoToAction) { string GoToActionName = f.GetNameFromValue(); if (parentActivity.GetAct(f.GetGuidFromValue(true), f.GetNameFromValue(true)) == null) { AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a); AA.Description = "Flow control is mapped to Action which does not exist";; AA.Details = "'" + GoToActionName + "' Action does not exist in '" + parentActivity.ActivityName + "' " + GingerDicser.GetTermResValue(eTermResKey.Activity); AA.HowToFix = "Remap the Flow Control Action"; if (parentActivity.Acts.Where(x => x.Description == f.GetNameFromValue()).FirstOrDefault() != null) { //can be auto fix AA.HowToFix = "Remap Flow Control Action. Auto fix found other Action with the same name so it will fix the mapping to this Action."; AA.ErrorInfoObject = f; AA.CanAutoFix = AnalyzerItemBase.eCanFix.Yes; AA.FixItHandler = FixFlowControlWrongActionMapping; } else { AA.CanAutoFix = AnalyzerItemBase.eCanFix.No; } AA.IssueType = eType.Error; AA.Impact = "Flow Control will fail on run time"; AA.Severity = eSeverity.High; IssuesList.Add(AA); } } if (f.FlowControlAction == eFlowControlAction.GoToActivity) { string GoToActivity = f.GetNameFromValue(); //if (BusinessFlow.Activities.Where(x => (x.ActivityName == GoToActivity)).FirstOrDefault() == null) if (BusinessFlow.GetActivity(f.GetGuidFromValue(true), f.GetNameFromValue(true)) == null) { AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a); AA.Description = "Flow control is mapped to " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " which does not exist";; AA.Details = "'" + GoToActivity + "' " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " does not exist in the '" + BusinessFlow.Name + " ' " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow); AA.HowToFix = "Remap the Flow Control Action"; if (BusinessFlow.Activities.Where(x => x.ActivityName == f.GetNameFromValue()).FirstOrDefault() != null) { //can be auto fix AA.HowToFix = "Remap Flow Control " + GingerDicser.GetTermResValue(eTermResKey.Activity) + ". Auto fix found other " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " with the same name so it will fix the mapping to this " + GingerDicser.GetTermResValue(eTermResKey.Activity) + "."; AA.ErrorInfoObject = f; AA.CanAutoFix = AnalyzerItemBase.eCanFix.Yes; AA.FixItHandler = FixFlowControlWrongActivityMapping; } else { AA.CanAutoFix = AnalyzerItemBase.eCanFix.No; } AA.IssueType = eType.Error; AA.Impact = "Flow Control will fail on run time"; AA.Severity = eSeverity.High; IssuesList.Add(AA); } } if (f.FlowControlAction == eFlowControlAction.GoToNextActivity) { if (BusinessFlow.Activities.IndexOf(parentActivity) == (BusinessFlow.Activities.Count() - 1)) { AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a); AA.Description = "Flow control is mapped to " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " which does not exist";; AA.Details = "Flow Control is set to 'GoToNextActivity' but the parent " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " is last one in flow."; AA.HowToFix = "Remap the Flow Control Action"; AA.CanAutoFix = AnalyzerItemBase.eCanFix.No; AA.IssueType = eType.Error; AA.Impact = "Flow Control will fail on run time"; AA.Severity = eSeverity.High; IssuesList.Add(AA); } } if (f.FlowControlAction == eFlowControlAction.SetVariableValue) { if (string.IsNullOrEmpty(f.Value) || ValueExpression.IsThisDynamicVE(f.Value) == false) { string SetVariableValue = f.GetNameFromValue(); string[] vals = SetVariableValue.Split(new char[] { '=' }); if (!BusinessFlow.CheckIfVariableExists(vals[0].ToString().Trim(), parentActivity)) { AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a); AA.Description = "Flow control mapped to " + GingerDicser.GetTermResValue(eTermResKey.Variable) + " which does not exist";; AA.Details = "'" + vals[0].Trim() + "' " + GingerDicser.GetTermResValue(eTermResKey.Variable) + " does not exist in parent items"; AA.HowToFix = "Remap the Flow Control Action"; AA.CanAutoFix = AnalyzerItemBase.eCanFix.No; AA.IssueType = eType.Error; AA.Impact = "Flow Control will fail on run time"; AA.Severity = eSeverity.High; IssuesList.Add(AA); } } } if (f.FlowControlAction == eFlowControlAction.RunSharedRepositoryActivity) { if (string.IsNullOrEmpty(f.Value) || ValueExpression.IsThisDynamicVE(f.Value) == false) { //f.CalcualtedValue(BusinessFlow, App.ProjEnvironment, WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems<DataSourceBase>()); string RunSharedRepositoryActivity = f.GetNameFromValue(); ObservableList <Activity> activities = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Activity>(); if (activities.Where(x => x.ActivityName == RunSharedRepositoryActivity).FirstOrDefault() == null) { AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a); AA.Description = "Flow control mapped to Shared Repository " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " which does not exist"; AA.Details = "'" + RunSharedRepositoryActivity + "' " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " does not exist in Shared Repository"; AA.HowToFix = "Remap the Flow Control Action"; AA.CanAutoFix = AnalyzerItemBase.eCanFix.No; AA.IssueType = eType.Error; AA.Impact = "Flow Control will fail on run time"; AA.Severity = eSeverity.High; IssuesList.Add(AA); } } } if (f.FlowControlAction == eFlowControlAction.GoToActivityByName) { if (string.IsNullOrEmpty(f.Value) || ValueExpression.IsThisDynamicVE(f.Value) == false) { string activityToGoTo = f.GetNameFromValue(); if (BusinessFlow.Activities.Where(x => x.ActivityName == activityToGoTo).FirstOrDefault() == null) { AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a); AA.Description = "Flow control mapped to " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " which does not exist"; AA.Details = "'" + activityToGoTo + "' " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " does not exist in the parent " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow); AA.HowToFix = "Remap the Flow Control Action"; AA.CanAutoFix = AnalyzerItemBase.eCanFix.No; AA.IssueType = eType.Error; AA.Impact = "Flow Control will fail on run time"; AA.Severity = eSeverity.High; IssuesList.Add(AA); } } } } } } if (a.ActReturnValues.Count > 0) { foreach (ActReturnValue ARV in a.ActReturnValues) { if (ARV.StoreTo != ActReturnValue.eStoreTo.None) { bool issueFound = false; if (string.IsNullOrEmpty(ARV.StoreToValue)) { issueFound = true; } else { switch (ARV.StoreTo) { case ActReturnValue.eStoreTo.Variable: if (BusinessFlow.GetAllVariables(parentActivity).Where(x => x.SupportSetValue && x.Name == ARV.StoreToValue).FirstOrDefault() == null) { issueFound = true; } break; case ActReturnValue.eStoreTo.GlobalVariable: if (WorkSpace.Instance.Solution.Variables.Where(x => x.SupportSetValue && x.Guid.ToString() == ARV.StoreToValue).FirstOrDefault() == null) { issueFound = true; } break; case ActReturnValue.eStoreTo.ApplicationModelParameter: if (WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <GlobalAppModelParameter>().Where(x => x.Guid.ToString() == ARV.StoreToValue).FirstOrDefault() == null) { issueFound = true; } break; case ActReturnValue.eStoreTo.DataSource: Regex rxDSPattern = new Regex(@"{(\bDS Name=)\w+\b[^{}]*}", RegexOptions.Compiled); MatchCollection matches = rxDSPattern.Matches(ARV.StoreToValue); foreach (Match match in matches) { if (GingerCoreNET.GeneralLib.General.CheckDataSource(match.Value, DSList) != "") { issueFound = true; } } break; } } if (issueFound) { AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a); AA.Description = string.Format("Output Value StoreTo has in-valid configuration"); AA.Details = string.Format("The '{0}' Output Value configured StoreTo from type '{1}' and value '{2}' is not valid", ARV.Param, ARV.StoreTo, ARV.StoreToValue); AA.HowToFix = "Re-configure StoreTo for the Output Value"; AA.CanAutoFix = AnalyzerItemBase.eCanFix.No; AA.IssueType = eType.Error; AA.Impact = "Execution might fail in run time"; AA.Severity = eSeverity.High; IssuesList.Add(AA); } } } } //Disabling the below because there are many actions which shows Locate By/Value but it is not needed for most operation types //if (a.ObjectLocatorConfigsNeeded == true && a.ActionDescription != "Script Action" && a.ActionDescription != "File Operations") //{ // if (a.LocateBy.ToString() == "NA") // { // AnalyzeAction AA = CreateNewIssue(IssuesList, BusinessFlow, parentActivity, a); // AA.Description = "Action is missing LocateBy value"; // AA.Details = "Action '" + a.Description + "' In " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " '" + parentActivity.ActivityName + "' is missing LocateBy value"; // AA.HowToFix = " Add LocateBy value to '" + a.Description + "'"; // AA.CanAutoFix = AnalyzerItemBase.eCanFix.No; // yes if we have one target app, or just set the first // AA.IssueType = eType.Warning; // AA.Impact = GingerDicser.GetTermResValue(eTermResKey.Activity) + " will not be executed and will fail"; // AA.Severity = eSeverity.Medium; // } // if (a.LocateValue == null || a.LocateValue == "") // { // AnalyzeAction AA = CreateNewIssue(IssuesList, BusinessFlow, parentActivity, a); // AA.Description = "Action is missing Locate Value "; // AA.Details = "Action '" + a.Description + "' In " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " '" + parentActivity.ActivityName + "' is missing Locate value"; // AA.HowToFix = " Add Locate Value to '" + a.Description + "'"; // AA.CanAutoFix = AnalyzerItemBase.eCanFix.No; // yes if we have one target app, or just set the first // AA.IssueType = eType.Warning; // AA.Impact = GingerDicser.GetTermResValue(eTermResKey.Activity) + " will not be executed and will fail"; // AA.Severity = eSeverity.Medium; // } //} VariableBase.GetListOfUsedVariables(a, ref ActivityUsedVariables); if (ActivityUsedVariables.Count > 0) { foreach (string Var in ActivityUsedVariables) { if (BusinessFlow.GetAllVariables(parentActivity).Where(x => x.Name == Var).Select(x => x.Name).FirstOrDefault() == null) { AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a); AA.Description = "The " + GingerDicser.GetTermResValue(eTermResKey.Variable) + " '" + Var + "' is missing"; AA.Details = "The " + GingerDicser.GetTermResValue(eTermResKey.Variable) + ": '" + Var + "' Does not exist In " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " '" + BusinessFlow.Name + "' => " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " '" + parentActivity.ActivityName + "' =>" + "Action '" + a.Description + "' "; AA.HowToFix = " Create new " + GingerDicser.GetTermResValue(eTermResKey.Variable) + " or Delete it from the action"; AA.CanAutoFix = AnalyzerItemBase.eCanFix.No; AA.IssueType = eType.Error; AA.Impact = GingerDicser.GetTermResValue(eTermResKey.Activity) + " will fail due to missing " + GingerDicser.GetTermResValue(eTermResKey.Variable); AA.Severity = eSeverity.High; AA.IssueCategory = eIssueCategory.MissingVariable; AA.IssueReferenceObject = Var; IssuesList.Add(AA); } } } GlobalAppModelParameter.GetListOfUsedGlobalParameters(a, ref mUsedGlobalParameters); if (mUsedGlobalParameters.Count > 0) { foreach (string Param in mUsedGlobalParameters) { GlobalAppModelParameter globalParam = mModelsGlobalParamsList.Where(x => x.PlaceHolder == Param).FirstOrDefault(); if (globalParam == null) { AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a); AA.Description = "The Application Global Parameter " + Param + " is missing"; AA.Details = "The Application Global Parameter: '" + Param + "' Does not exist in Models Global Parameters"; AA.HowToFix = " Create new Application Global Parameter or Delete it from the action."; AA.CanAutoFix = AnalyzerItemBase.eCanFix.No; AA.IssueType = eType.Error; AA.Impact = GingerDicser.GetTermResValue(eTermResKey.Activity) + " will fail due to missing " + GingerDicser.GetTermResValue(eTermResKey.Variable); AA.Severity = eSeverity.High; IssuesList.Add(AA); } } } GetAllStoreToGlobalParameters(a, mModelsGlobalParamsList, ref mMissingStoreToGlobalParameters); if (mMissingStoreToGlobalParameters.Count > 0) { foreach (string Param in mMissingStoreToGlobalParameters) { AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a); AA.Description = "The Output Value with Parameter '" + Param + "' is having store to Parameter which doesn't exist anymore"; AA.Details = "The Output Value with Parameter: '" + Param + "' can be found at " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " '" + BusinessFlow.Name + "' => " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " '" + parentActivity.ActivityName + "' =>" + "Action '" + a.Description + "' "; AA.HowToFix = " Create new Parameter and change to it in the 'Store to' dropdown under the above path"; AA.CanAutoFix = AnalyzerItemBase.eCanFix.No; AA.IssueType = eType.Error; AA.Impact = GingerDicser.GetTermResValue(eTermResKey.Activity) + " will fail due to missing Parameter"; AA.Severity = eSeverity.High; IssuesList.Add(AA); } } // Put All Special Actions Analyze Here //actions combination if (a.GetType().ToString() == "ActLaunchJavaWSApplication")//forbidden combination: Launch & (platform\agent manipulation action) { List <IAct> driverActs = parentActivity.Acts.Where(x => ((x is ActWithoutDriver && x.GetType() != typeof(ActAgentManipulation)) == false) && x.Active == true).ToList(); if (driverActs.Count > 0) { string list = string.Join(",", driverActs.Select(x => x.ActionDescription).ToList().ToArray()); AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a); AA.Description = GingerDicser.GetTermResValue(eTermResKey.Activity) + " has forbidden combinations"; AA.Details = GingerDicser.GetTermResValue(eTermResKey.Activity) + " has " + a.ActionDescription + " Action with the following platform actions: " + list + ".\nPlatform action inside this current " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " will try to activate the agent before the application is launch(will cause agent issue)."; AA.HowToFix = "Open the " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " and put " + a.ActionDescription + " Action in a separate " + GingerDicser.GetTermResValue(eTermResKey.Activity); AA.CanAutoFix = AnalyzerItemBase.eCanFix.No; // we can autofix by delete, but don't want to AA.IssueType = eType.Error; AA.Impact = GingerDicser.GetTermResValue(eTermResKey.Activity) + " will be executed and will fail due to java agent connection"; AA.Severity = eSeverity.High; IssuesList.Add(AA); } } if (a.LocateBy == eLocateBy.POMElement || ((a is ActUIElement) && ((ActUIElement)a).ElementLocateBy == eLocateBy.POMElement)) { try { string[] pOMandElementGUIDs; if (a is ActUIElement) { pOMandElementGUIDs = ((ActUIElement)a).ElementLocateValue.Split('_'); } else { pOMandElementGUIDs = a.LocateValue.Split('_'); } Guid selectedPOMGUID = new Guid(pOMandElementGUIDs[0]); ApplicationPOMModel POM = WorkSpace.Instance.SolutionRepository.GetRepositoryItemByGuid <ApplicationPOMModel>(selectedPOMGUID); if (POM == null) { AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a); AA.Description = "Action's mapped Page Objects Model is missing"; AA.Details = "Action " + a.ActionDescription + " has mapped Page Objects Model which is missing, reason can be that the Page Objects Model has been deleted after mapping it to this action."; AA.HowToFix = "Open the " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " and the Action in order to map different Page Objects Model and Element"; AA.CanAutoFix = AnalyzerItemBase.eCanFix.No; AA.IssueType = eType.Error; AA.Impact = "Action will fail during execution"; AA.Severity = eSeverity.High; IssuesList.Add(AA); } else { Guid selectedPOMElementGUID = new Guid(pOMandElementGUIDs[1]); ElementInfo selectedPOMElement = (ElementInfo)POM.MappedUIElements.Where(z => z.Guid == selectedPOMElementGUID).FirstOrDefault(); if (selectedPOMElement == null) { AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a); AA.Description = "Page Objects Model Element which mapped to this action is missing"; AA.Details = "Action " + a.ActionDescription + " has mapped Page Objects Model Element which is missing, reason can be that the Element has been deleted after mapping it to this action."; AA.HowToFix = "Open the " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " and the Action in order to map different Element"; AA.CanAutoFix = AnalyzerItemBase.eCanFix.No; AA.IssueType = eType.Error; AA.Impact = "Action will fail during execution"; AA.Severity = eSeverity.High; IssuesList.Add(AA); } } } catch (Exception ex) { Console.WriteLine("Analyzer" + ex.Message); //TODO: try to find the failure outside exception AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a); AA.Description = "Action's mapped Page Objects Model or Element is invalid"; AA.Details = "Action " + a.ActionDescription + " has invalid mapped Page Objects Model or Element."; AA.HowToFix = "Open the " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " and the Action in order to map different Page Objects Model and Element"; AA.CanAutoFix = AnalyzerItemBase.eCanFix.No; AA.IssueType = eType.Error; AA.Impact = "Action will fail during execution"; AA.Severity = eSeverity.High; IssuesList.Add(AA); } } //Check for duplicate ActInputValues if (a.InputValues.Count > 0) { foreach (ActInputValue AIV in a.InputValues.ToList()) { if (a.InputValues.Where(aiv => aiv.Param == AIV.Param).ToList().Count > 1) { AnalyzeAction AA = CreateNewIssue(BusinessFlow, parentActivity, a); AA.Description = "The Input Value Parameter " + AIV.Param + " is Duplicate"; AA.Details = "The Input Value Parameter: '" + AIV.Param + "' is duplicate in the ActInputValues"; AA.HowToFix = "Open action Edit page and save it."; AA.CanAutoFix = AnalyzerItemBase.eCanFix.Yes; AA.IssueType = eType.Warning; AA.Impact = "Duplicate input values will present in the report."; AA.Severity = eSeverity.Low; AA.ErrorInfoObject = AIV; AA.FixItHandler = FixRemoveDuplicateActInputValues; IssuesList.Add(AA); } } } return(IssuesList); }
private async void SaveAllBizFlowsButton_Click(object sender, RoutedEventArgs e) { await Task.Run(() => { foreach (RepositoryItemUsage usage in RepoItemUsages) { if (usage.Status == RepositoryItemUsage.eStatus.Updated || usage.Status == RepositoryItemUsage.eStatus.SaveFailed) { try { Reporter.ToStatus(eStatusMsgKey.SaveItem, null, usage.HostBusinessFlow.Name, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow)); WorkSpace.Instance.SolutionRepository.SaveRepositoryItem(usage.HostBusinessFlow); usage.Status = RepositoryItemUsage.eStatus.UpdatedAndSaved; Reporter.HideStatusMessage(); } catch (Exception ex) { usage.Status = RepositoryItemUsage.eStatus.SaveFailed; Reporter.HideStatusMessage(); Reporter.ToLog(eLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {ex.Message}", ex); } } } } ); }
private void SetUsagesGridView() { if (mRepoItem is Activity) { usageGrid.Title = "'" + ((Activity)mRepoItem).ActivityName + "' " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " Repository Item Usages"; } else if (mRepoItem is ActivitiesGroup) { usageGrid.Title = "'" + ((ActivitiesGroup)mRepoItem).Name + "' " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup) + " Repository Item Usages"; } else if (mRepoItem is Act) { usageGrid.Title = "'" + ((Act)mRepoItem).Description + "' Action Repository Item Usages"; } else if (mRepoItem is VariableBase) { usageGrid.Title = "'" + ((VariableBase)mRepoItem).Name + "' " + GingerDicser.GetTermResValue(eTermResKey.Variable) + " Repository Item Usages"; } GridViewDef view = new GridViewDef(GridViewDef.DefaultViewName); view.GridColsView = new ObservableList <GridColView>(); view.GridColsView.Add(new GridColView() { Field = RepositoryItemUsage.Fields.Selected, StyleType = GridColView.eGridColStyleType.CheckBox, WidthWeight = 10 }); view.GridColsView.Add(new GridColView() { Field = RepositoryItemUsage.Fields.HostBizFlowPath, Header = GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), WidthWeight = 25, ReadOnly = true }); if (mRepoItem is Act || mRepoItem is VariableBase) { view.GridColsView.Add(new GridColView() { Field = RepositoryItemUsage.Fields.HostActivityName, Header = GingerDicser.GetTermResValue(eTermResKey.Activity), WidthWeight = 25, ReadOnly = true }); } view.GridColsView.Add(new GridColView() { Field = RepositoryItemUsage.Fields.UsageItemName, Header = "Usage Name", WidthWeight = 25, ReadOnly = true }); view.GridColsView.Add(new GridColView() { Field = RepositoryItemUsage.Fields.UsageExtraDetails, Header = "Usage Extra Details", WidthWeight = 20, ReadOnly = true }); view.GridColsView.Add(new GridColView() { Field = RepositoryItemUsage.Fields.UsageItemType, Header = "Usage Type", WidthWeight = 20, ReadOnly = true }); view.GridColsView.Add(new GridColView() { Field = RepositoryItemUsage.Fields.SelectedItemPart, Header = "Part to Update ", StyleType = GridColView.eGridColStyleType.Template, CellTemplate = ucGrid.GetGridComboBoxTemplate(RepositoryItemUsage.Fields.ItemParts, RepositoryItemUsage.Fields.SelectedItemPart, false), WidthWeight = 20 }); view.GridColsView.Add(new GridColView() { Field = RepositoryItemUsage.Fields.Status, WidthWeight = 15, ReadOnly = true }); usageGrid.SetAllColumnsDefaultView(view); usageGrid.InitViewItems(); usageGrid.AddToolbarTool("@Checkbox_16x16.png", "Select / Un-Select All", new RoutedEventHandler(SelectUnSelectAll)); usageGrid.AddToolbarTool("@DropDownList_16x16.png", "Set Same Selected Part to All", new RoutedEventHandler(SetSamePartToAll)); }
private void ProcessActions(ConvertedCodeLine CCL) { string CodeLine = CCL.CodeLine; string value = ""; string SetValueinObject = ""; string varName = ""; string xpath = ""; string type = ""; if (CodeLine.Contains("WebEdit")) { if (CodeLine.Contains("WebEditTxtChange")) { type = "Edit Box"; SetValueinObject = GetStringBetween(CodeLine, ".WebEdit(\"", "\")"); varName = CodeLine.Substring(CodeLine.IndexOf("GlobalDictionary")).Replace("GlobalDictionary", "").Trim(); varName = varName.Replace("(", "").Replace(")", ""); value = "{Var Name=" + varName + "}"; //Calling function to identify Locate By and Locate Value xpath = ProcessLocateBy_Value(SetValueinObject); } // Add Action to biz flow ActGenElement act = new ActGenElement(); act.Value = value.Replace("\"", "").Replace("\"", ""); act.GenElementAction = ActGenElement.eGenElementAction.SetValue; act.LocateBy = eLocateBy.ByXPath; act.LocateValue = xpath; act.Description = "Set value in " + SetValueinObject + " " + type; mBusinessFlow.AddAct(act); CCL.Converted = "New Action - ActGenElement.SetValue : LocateValue=" + act.LocateValue + ", Value=" + act.Value; CCL.Status = ConvertedCodeLine.eStatus.ConvertedToScript; } // Extract the WebEdit/WebCheckBox else if (CodeLine.Contains(".Set") || CodeLine.Contains(".set")) { if (CodeLine.Contains("WebEdit")) { type = "Edit Box"; SetValueinObject = GetStringBetween(CodeLine, ".WebEdit(\"", "\")"); //Calling function to identify Locate By and Locate Value xpath = ProcessLocateBy_Value(SetValueinObject); } else if (CodeLine.Contains("WebCheckBox")) { type = "Check Box"; SetValueinObject = GetStringBetween(CodeLine, ".WebCheckBox(\"", "\")"); //Calling function to identify Locate By and Locate Value xpath = ProcessLocateBy_Value(SetValueinObject); } // for Values to Set if (CodeLine.Contains("Set \"")) // For hard coded values { value = GetStringBetween(CodeLine, "Set \"", CodeLine[CodeLine.Length - 1].ToString()); } else if (CodeLine.Contains("GlobalDictionary")) { varName = CodeLine.Substring(CodeLine.IndexOf("GlobalDictionary")).Replace("GlobalDictionary", "").Trim(); varName = varName.Replace("(", "").Replace(")", ""); value = "{Var Name=" + varName + "}"; } else if (CodeLine.Contains("Globaldictionary")) { varName = CodeLine.Substring(CodeLine.IndexOf("Globaldictionary")).Replace("Globaldictionary", "").Trim(); varName = varName.Replace("(", "").Replace(")", ""); value = "{Var Name=" + varName + "}"; } else if (!CodeLine.Contains("GlobalDictionary") && !CodeLine.Contains("Globaldictionary")) // for variables declared using Dim { varName = CodeLine.Substring(CodeLine.IndexOf("Set")).Replace("Set", "").Trim(); value = "{Var Name=" + varName + "}"; VariableString v = new VariableString(); v.Description = GingerDicser.GetTermResValue(eTermResKey.Variable) + " added by UFT Script"; v.Name = varName; v.Value = value; mBusinessFlow.AddVariable(v); } // Add Action to biz flow ActGenElement act = new ActGenElement(); act.Value = value.Replace("\"", "").Replace("\"", ""); act.GenElementAction = ActGenElement.eGenElementAction.SetValue; act.LocateBy = eLocateBy.ByXPath; act.LocateValue = xpath; act.Description = "Set value in " + SetValueinObject + " " + type; mBusinessFlow.AddAct(act); CCL.Converted = "New Action - ActGenElement.SetValue : LocateValue=" + act.LocateValue + ", Value=" + act.Value; CCL.Status = ConvertedCodeLine.eStatus.ConvertedToScript; } // Extract the WebButton/Link/Image/WebELemnt else if (CodeLine.Contains(".Click") || CodeLine.Contains(".click")) { if (CodeLine.Contains("WebButton")) { type = "Button"; SetValueinObject = GetStringBetween(CodeLine, ".WebButton(\"", "\")"); //Calling function to identify Locate By and Locate Value xpath = ProcessLocateBy_Value(SetValueinObject); } else if (CodeLine.Contains("Link")) { type = "Link"; SetValueinObject = GetStringBetween(CodeLine, ".Link(\"", "\")"); //Calling function to identify Locate By and Locate Value xpath = ProcessLocateBy_Value(SetValueinObject); } else if (CodeLine.Contains("WebElement")) { type = "Web Element"; SetValueinObject = GetStringBetween(CodeLine, ".WebElement(\"", "\")"); //Calling function to identify Locate By and Locate Value xpath = ProcessLocateBy_Value(SetValueinObject); } else if (CodeLine.Contains("Image")) { type = "Image"; SetValueinObject = GetStringBetween(CodeLine, ".Image(\"", "\")"); //Calling function to identify Locate By and Locate Value xpath = ProcessLocateBy_Value(SetValueinObject); } // Add Action to biz flow ActGenElement act = new ActGenElement(); act.Value = ""; act.LocateBy = eLocateBy.ByXPath; act.LocateValue = xpath; act.GenElementAction = ActGenElement.eGenElementAction.Click; act.Description = "Click on " + SetValueinObject + " " + type; mBusinessFlow.AddAct(act); CCL.Converted = "New Action - ActGenElement.Click : LocateValue=" + act.LocateValue; // +", Value=" + act.Value; CCL.Status = ConvertedCodeLine.eStatus.ConvertedToScript; } // Extract the WeBlist/WebRadiogroup else if (CodeLine.Contains(".Select") || CodeLine.Contains(".select")) { if (CodeLine.Contains("WebList")) { type = "List"; SetValueinObject = GetStringBetween(CodeLine, ".WebList(\"", "\")"); //Calling function to identify Locate By and Locate Value xpath = ProcessLocateBy_Value(SetValueinObject); } else if (CodeLine.Contains("WebRadiogroup")) { type = "Radio Group"; SetValueinObject = GetStringBetween(CodeLine, ".WebRadiogroup(\"", "\")"); //Calling function to identify Locate By and Locate Value xpath = ProcessLocateBy_Value(SetValueinObject); } //For Values to Set if (CodeLine.Contains("Select \"")) // For hard coded values { value = GetStringBetween(CodeLine, "Select \"", CodeLine[CodeLine.Length - 1].ToString()); } else if (CodeLine.Contains("GlobalDictionary")) { varName = CodeLine.Substring(CodeLine.IndexOf("GlobalDictionary")).Replace("GlobalDictionary", "").Trim(); varName = varName.Replace("(", "").Replace(")", ""); value = "{Var Name=" + varName + "}"; } else if (CodeLine.Contains("Globaldictionary")) { varName = CodeLine.Substring(CodeLine.IndexOf("Globaldictionary")).Replace("Globaldictionary", "").Trim(); varName = varName.Replace("(", "").Replace(")", ""); value = "{Var Name=" + varName + "}"; } else { varName = CodeLine.Substring(CodeLine.IndexOf("Select ")).Replace("Select ", "").Trim(); value = "{Var Name=" + varName + "}"; VariableString v = new VariableString(); v.Description = GingerDicser.GetTermResValue(eTermResKey.Variable) + " added by UFT Script"; v.Name = varName; v.Value = value; mBusinessFlow.AddVariable(v); } // Add Action to biz flow ActGenElement act = new ActGenElement(); act.Value = value; act.LocateBy = eLocateBy.ByXPath; act.LocateValue = xpath; act.GenElementAction = ActGenElement.eGenElementAction.SetValue; act.Description = "Select value from " + SetValueinObject + " " + type; mBusinessFlow.AddAct(act); CCL.Converted = "New Action - ActGenElement.SetValue : LocateValue=" + act.LocateValue + ", Value=" + act.Value; CCL.Status = ConvertedCodeLine.eStatus.ConvertedToScript; } // Extract the URL to Navigate to else if (CodeLine.Contains("Navigate")) { // Extract the URL string URL = GetStringBetween(CodeLine, ".Navigate(\"", "\")"); // Add Action to biz flow ActGotoURL act = new ActGotoURL(); act.Value = URL; act.Description = "Navigate to URL"; mBusinessFlow.AddAct(act); CCL.Converted = "New Action - ActGotoURL : " + URL; CCL.Status = ConvertedCodeLine.eStatus.ConvertedToScript; } // Extract the URL launched using SystemUtil.Run else if (CodeLine.Contains("SystemUtil.Run") && CodeLine.Contains("iexplore.exe")) { // Extract the URL string URL = GetStringBetween(CodeLine, "iexplore.exe\",\"", "\""); // Add Action to biz flow ActGotoURL act = new ActGotoURL(); act.Value = URL; act.Description = "Navigate to URL"; mBusinessFlow.AddAct(act); CCL.Converted = "New Action - ActGotoURL : " + URL; CCL.Status = ConvertedCodeLine.eStatus.ConvertedToScript; } else if (CodeLine.Contains("fDBCheck") || CodeLine.Contains("fDBActivities")) //ASAP function { // Temp until we read the SQL from common.xls ActDBValidation act = new ActDBValidation(); act.Description = "DB Action-Configure Manually"; mBusinessFlow.AddAct(act); CCL.Converted = "New Action - DB Action "; CCL.Status = ConvertedCodeLine.eStatus.ConvertedToScript; } }
// fix public override void ActivityEnd(uint eventTime, Activity activity, bool offlineMode = false) { object AR = mExecutionLogger.SetReportActivity(activity, mContext, offlineMode, Configuration.ExecutionLoggerConfigurationIsEnabled); if (!offlineMode) { ExecutionProgressReporterListener.AddExecutionDetailsToLog(ExecutionProgressReporterListener.eExecutionPhase.End, GingerDicser.GetTermResValue(eTermResKey.Activity), activity.ActivityName, AR); } }
public override void ActivityGroupStart(uint eventTime, ActivitiesGroup activityGroup) { activityGroup.StartTimeStamp = eventTime; // DateTime.Now.ToUniversalTime(); ExecutionProgressReporterListener.AddExecutionDetailsToLog(ExecutionProgressReporterListener.eExecutionPhase.Start, GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup), activityGroup.Name, null); }
private ExecutionResult GetExeResultforAg(BusinessFlow businessFlow, string bfExportedID, ActivitiesGroup activGroup, ref string result, RQMTestPlan testPlan) { try { LoginDTO loginData = new LoginDTO() { User = ALMCore.DefaultAlmConfig.ALMUserName, Password = ALMCore.DefaultAlmConfig.ALMPassword, Server = ALMCore.DefaultAlmConfig.ALMServerURL }; if (string.IsNullOrEmpty(activGroup.ExternalID)) { result = "At " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + ": " + businessFlow.Name + " " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup) + ", is missing ExternalID, cannot export RQM TestPlan execution results without External ID"; return(null); } ExecutionResult exeResult = new ExecutionResult { TestPlanExportID = bfExportedID }; List <Activity> relevantActivities = new List <Activity>(); relevantActivities = businessFlow.Activities.Where(x => x.ActivitiesGroupID == activGroup.FileName).ToList(); exeResult.ExecutionStep = new List <ExecutionStep>(); string txExportID = GetExportedIDString(activGroup.ExternalID, "RQMID"); string tsExportID = GetExportedIDString(activGroup.ExternalID, "RQMScriptID"); string erExportID = GetExportedIDString(activGroup.ExternalID, "RQMRecordID"); if ((activGroup.TestSuiteId != null) && (activGroup.TestSuiteId != string.Empty)) { // check if test suite execution record is exists per current Test Suite ID // if not exists to create it and than procced to work on just created RQMTestSuite testSuite = testPlan.TestSuites.Where(z => z.RQMID == activGroup.TestSuiteId).FirstOrDefault(); if ((testSuite != null) && (testSuite.RQMID != null) && (testSuite.URLPathVersioned != null) && (testSuite.RQMID != string.Empty) && (testSuite.URLPathVersioned != string.Empty)) { try { ResultInfo resultInfo; // check if execution record of testSuite exist. If not - to create it if ((testSuite.TestSuiteExecutionRecord == null) || (testSuite.TestSuiteExecutionRecord.RQMID == null) || (testSuite.TestSuiteExecutionRecord.URLPathVersioned == string.Empty)) { testSuite.ACL_TestSuite_Copy = new TestSuite(); testSuite.ACL_TestSuite_Copy.TestSuiteName = testSuite.Name; testSuite.ACL_TestSuite_Copy.TestSuiteExportID = testSuite.RQMID; resultInfo = RQMConnect.Instance.RQMRep.CreateTestSuiteExecutionRecord(loginData, RQMCore.ALMProjectGuid, ALMCore.DefaultAlmConfig.ALMProjectName, RQMCore.ALMProjectGroupName, testSuite.ACL_TestSuite_Copy, bfExportedID, businessFlow.Name.ToString()); if (resultInfo.IsSuccess) { if (testSuite.TestSuiteExecutionRecord == null) { testSuite.TestSuiteExecutionRecord = new RQMTestSuiteExecutionRecord(); } testSuite.TestSuiteExecutionRecord.RQMID = testSuite.ACL_TestSuite_Copy.TestSuiteExecutionRecordExportID; testSuite.TestSuiteExecutionRecord.URLPathVersioned = testSuite.ACL_TestSuite_Copy.TestSuiteExecutionRecordExportUri; } } else { testSuite.ACL_TestSuite_Copy = new TestSuite(); testSuite.ACL_TestSuite_Copy.TestSuiteName = testSuite.Name; testSuite.ACL_TestSuite_Copy.TestSuiteExportID = testSuite.RQMID; testSuite.ACL_TestSuite_Copy.TestSuiteExecutionRecordExportID = testSuite.TestSuiteExecutionRecord.RQMID; testSuite.ACL_TestSuite_Copy.TestSuiteExecutionRecordExportUri = testSuite.TestSuiteExecutionRecord.URLPathVersioned; } // after creating of execution record at RQM and as object at Ginger (or checking that it's exists) // need to create testsuiteLOG on it and add test caseexecution records on it Ginger (the objects at RQM will be created after loop) ACL_Data_Contract.Activity currentActivity = GetTestCaseFromActivityGroup(activGroup); resultInfo = RQMConnect.Instance.RQMRep.CreateExecutionRecordPerActivityWithInTestSuite(loginData, RQMCore.ALMProjectGuid, ALMCore.DefaultAlmConfig.ALMProjectName, RQMCore.ALMProjectGroupName, currentActivity, bfExportedID, businessFlow.Name, testSuite.Name.ToString()); if (resultInfo.IsSuccess) { if ((testSuite.TestSuiteExecutionRecord.TestSuiteResults == null) || (testSuite.TestSuiteExecutionRecord.TestSuiteResults.Count == 0) || (testSuite.TestSuiteExecutionRecord.CurrentTestSuiteResult == null)) { testSuite.TestSuiteExecutionRecord.TestSuiteResults = new ObservableList <RQMTestSuiteResults>(); testSuite.TestSuiteExecutionRecord.CurrentTestSuiteResult = new RQMTestSuiteResults(); testSuite.TestSuiteExecutionRecord.CurrentTestSuiteResult.RQMExecutionRecords = new ObservableList <RQMExecutionRecord>(); testSuite.TestSuiteExecutionRecord.TestSuiteResults.Add(testSuite.TestSuiteExecutionRecord.CurrentTestSuiteResult); } RQMExecutionRecord executionRecord = new RQMExecutionRecord(currentActivity.ExportedTcExecutionRecId.ToString(), currentActivity.ExportedTestScriptId.ToString(), currentActivity.ExportedID.ToString()); testSuite.TestSuiteExecutionRecord.CurrentTestSuiteResult.RQMExecutionRecords.Add(executionRecord); testSuite.TestSuiteExecutionRecord.CurrentTestSuiteResult.ACL_TestSuiteLog_Copy.TestSuiteLogExecutionRecords.Add(exeResult); exeResult.ExpectedResultName = currentActivity.EntityName; erExportID = executionRecord.RQMID; currentActivity.ExportedID = long.Parse(executionRecord.RQMID); string atsID = GetExportedIDString(activGroup.ExternalID, "AtsID"); if (atsID == "0") { atsID = string.Empty; } activGroup.ExternalID = "RQMID=" + txExportID + "|RQMScriptID=" + tsExportID + "|RQMRecordID=" + erExportID + "|AtsID=" + atsID; } } catch { } } else { } } else if (string.IsNullOrEmpty(erExportID) || erExportID.Equals("0") || !testPlan.RQMExecutionRecords.Select(z => z.RQMID).ToList().Contains(erExportID)) { ResultInfo resultInfo; ACL_Data_Contract.Activity currentActivity = GetTestCaseFromActivityGroup(activGroup); try { // check if executionRecordID exist in RQM but still was not updated in business flow XML RQMExecutionRecord currentExecutionRecord = testPlan.RQMExecutionRecords.Where(y => y.RelatedTestCaseRqmID == txExportID && y.RelatedTestScriptRqmID == tsExportID).ToList().FirstOrDefault(); if (currentExecutionRecord != null) { erExportID = currentExecutionRecord.RQMID; } else { // if executionRecord not updated and not exists - so create one in RQM and update BussinesFlow object (this may be not saved due not existed "autosave" functionality) resultInfo = RQMConnect.Instance.RQMRep.CreateExecutionRecordPerActivity(loginData, RQMCore.ALMProjectGuid, ALMCore.DefaultAlmConfig.ALMProjectName, RQMCore.ALMProjectGroupName, currentActivity, bfExportedID, businessFlow.Name); if (!currentActivity.ExportedTcExecutionRecId.Equals("0")) { string atsID = GetExportedIDString(activGroup.ExternalID, "AtsID"); if (atsID == "0") { atsID = string.Empty; } erExportID = currentActivity.ExportedTcExecutionRecId.ToString(); activGroup.ExternalID = "RQMID=" + txExportID + "|RQMScriptID=" + tsExportID + "|RQMRecordID=" + erExportID + "|AtsID=" + atsID; ; } } } catch { Reporter.ToLog(eLogLevel.ERROR, "Failed to create Execution Record Per Activity - " + currentActivity.EntityName); } } if (string.IsNullOrEmpty(txExportID) || string.IsNullOrEmpty(tsExportID) || string.IsNullOrEmpty(erExportID) || txExportID.Equals("0") || tsExportID.Equals("0") || erExportID.Equals("0")) { result = "At " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + ": " + businessFlow.Name + " " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup) + ", is missing ExternalID, cannot export RQM TestPlan execution results without Extrnal ID"; return(null); } exeResult.TestCaseExportID = txExportID; exeResult.TestScriptExportID = tsExportID; exeResult.ExecutionRecordExportID = erExportID; int i = 1; foreach (Activity act in relevantActivities) { ExecutionStep exeStep = new ExecutionStep { StepExpResults = act.Expected, StepOrderId = i, EntityDesc = act.ActivityName, }; i++; switch (act.Status) { case Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed: exeStep.StepStatus = ACL_Data_Contract.ExecutoinStatus.Failed; string errors = string.Empty; List <IAct> failedActs = act.Acts.Where(x => x.Status == Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed).ToList(); foreach (IAct action in failedActs) { errors += action.Error + Environment.NewLine; } exeStep.StepActualResult = errors; break; case Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed: exeStep.StepStatus = ACL_Data_Contract.ExecutoinStatus.Passed; exeStep.StepActualResult = "Passed as expected"; break; case Amdocs.Ginger.CoreNET.Execution.eRunStatus.NA: exeStep.StepStatus = ACL_Data_Contract.ExecutoinStatus.NA; exeStep.StepActualResult = "NA"; break; case Amdocs.Ginger.CoreNET.Execution.eRunStatus.Pending: exeStep.StepStatus = ACL_Data_Contract.ExecutoinStatus.In_Progress; exeStep.StepActualResult = "Was not executed"; break; case Amdocs.Ginger.CoreNET.Execution.eRunStatus.Running: exeStep.StepStatus = ACL_Data_Contract.ExecutoinStatus.In_Progress; exeStep.StepActualResult = "Not Completed"; break; case Amdocs.Ginger.CoreNET.Execution.eRunStatus.Skipped: exeStep.StepStatus = ACL_Data_Contract.ExecutoinStatus.Outscoped; exeStep.StepActualResult = "Skipped"; break; case Amdocs.Ginger.CoreNET.Execution.eRunStatus.Blocked: exeStep.StepStatus = ACL_Data_Contract.ExecutoinStatus.Blocked; exeStep.StepActualResult = "Blocked"; break; case Amdocs.Ginger.CoreNET.Execution.eRunStatus.Stopped: exeStep.StepStatus = ACL_Data_Contract.ExecutoinStatus.Inconclusive; exeStep.StepActualResult = "Stopped"; break; } exeResult.ExecutionStep.Add(exeStep); } return(exeResult); } catch (Exception ex) { result = "Unexpected error occurred- " + ex.Message; Reporter.ToLog(eLogLevel.ERROR, "Failed to export execution details to RQM/ALM", ex); return(null); } }
public override void ActivityGroupEnd(uint eventTime, ActivitiesGroup activityGroup, bool offlineMode = false) { //ActivityGroupReport AGR = new ActivityGroupReport(activityGroup, mContext.BusinessFlow); object AGR = mExecutionLogger.SetReportActivityGroup(activityGroup, mContext.BusinessFlow, offlineMode); if (!offlineMode) { ExecutionProgressReporterListener.AddExecutionDetailsToLog(ExecutionProgressReporterListener.eExecutionPhase.End, GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup), activityGroup.Name, AGR); } }
public bool ExportExecutionDetailsToRQM(BusinessFlow businessFlow, ref string result, bool exectutedFromAutomateTab = false, PublishToALMConfig publishToALMConfig = null) { result = string.Empty; string bfExportedID = GetExportedIDString(businessFlow.ExternalID, "RQMID"); if (string.IsNullOrEmpty(bfExportedID) || bfExportedID.Equals("0")) { result = GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + ": " + businessFlow.Name + " is missing ExternalID, cannot export RQM TestPlan execution results without External ID"; return(false); } if (businessFlow.ActivitiesGroups.Count == 0) { result = GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + ": " + businessFlow.Name + " Must have at least one " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup); return(false); } LoginDTO loginData = new LoginDTO() { User = ALMCore.DefaultAlmConfig.ALMUserName, Password = ALMCore.DefaultAlmConfig.ALMPassword, Server = ALMCore.DefaultAlmConfig.ALMServerURL }; // // get data about execution records per current test plan - start RQMTestPlan testPlan = new RQMTestPlan(); string importConfigTemplate = System.IO.Path.Combine(RQMCore.ConfigPackageFolderPath, "RQM_Import", "RQM_ImportConfigs_Template.xml"); if (File.Exists(importConfigTemplate)) { XmlSerializer serializer = new XmlSerializer(typeof(RQMProjectListConfiguration)); FileStream fs = new FileStream(importConfigTemplate, FileMode.Open); XmlReader reader = XmlReader.Create(fs); RQMProjectListConfiguration RQMProjectList; RQMProjectList = (RQMProjectListConfiguration)serializer.Deserialize(reader); fs.Close(); RQMProject currentRQMProjectMapping; if (RQMProjectList.RQMProjects.Count > 0) { currentRQMProjectMapping = RQMProjectList.RQMProjects.Where(x => x.Name == ALMCore.DefaultAlmConfig.ALMProjectName || x.Name == "DefaultProjectName").FirstOrDefault(); if (currentRQMProjectMapping != null) { testPlan = RQMConnect.Instance.GetRQMTestPlanByIdByProject(ALMCore.DefaultAlmConfig.ALMServerURL, ALMCore.DefaultAlmConfig.ALMUserName, ALMCore.DefaultAlmConfig.ALMPassword, ALMCore.DefaultAlmConfig.ALMProjectName, GetExportedIDString(businessFlow.ExternalID, "RQMID")); if (testPlan == null) { result = "Recent Testing Plan not exists in connected RQM project."; return(false); } testPlan.RQMExecutionRecords = RQMConnect.Instance.GetExecutionRecordsByTestPlan(loginData, reader, currentRQMProjectMapping, RQMCore.ALMProjectGroupName, RQMCore.ALMProjectGuid, testPlan.URLPathVersioned); } } } // get data about execution records per current test plan - finish List <ExecutionResult> exeResultList = new List <ExecutionResult>(); foreach (ActivitiesGroup activGroup in businessFlow.ActivitiesGroups) { if ((publishToALMConfig.FilterStatus == FilterByStatus.OnlyPassed && activGroup.RunStatus == eActivitiesGroupRunStatus.Passed) || (publishToALMConfig.FilterStatus == FilterByStatus.OnlyFailed && activGroup.RunStatus == eActivitiesGroupRunStatus.Failed) || publishToALMConfig.FilterStatus == FilterByStatus.All) { ExecutionResult exeResult = GetExeResultforAg(businessFlow, bfExportedID, activGroup, ref result, testPlan); if (exeResult != null) { exeResultList.Add(exeResult); } else { return(false); } } } ResultInfo resultInfo = new ResultInfo(); // // Updating of Execution Record Results (test plan level) try { resultInfo = RQMConnect.Instance.RQMRep.ExportExecutionResult(loginData, exeResultList, RQMCore.ALMProjectGuid, ALMCore.DefaultAlmConfig.ALMProjectName, RQMCore.ALMProjectGroupName); } catch { Reporter.ToLog(eLogLevel.ERROR, "Failed to Update Execution Record Results"); } // // Creating Test Suite Log (per test suite) try { foreach (RQMTestSuite rQMTestSuite in testPlan.TestSuites) { if ((rQMTestSuite.ACL_TestSuite_Copy != null) && (rQMTestSuite.TestSuiteExecutionRecord.CurrentTestSuiteResult.ACL_TestSuiteLog_Copy != null)) { resultInfo = RQMConnect.Instance.RQMRep.CreateTestSuiteLog(loginData, RQMCore.ALMProjectGuid, ALMCore.DefaultAlmConfig.ALMProjectName, RQMCore.ALMProjectGroupName, rQMTestSuite.ACL_TestSuite_Copy, rQMTestSuite.TestSuiteExecutionRecord.CurrentTestSuiteResult.ACL_TestSuiteLog_Copy); } } } catch { Reporter.ToLog(eLogLevel.ERROR, "Failed to Update Execution Record Results"); } // // Attaching of Activity Groups Reports try { // Attach ActivityGroup Report if needed if ((publishToALMConfig.ToAttachActivitiesGroupReport) || (exectutedFromAutomateTab)) { foreach (ActivitiesGroup activGroup in businessFlow.ActivitiesGroups) { try { ACL_Data_Contract.Activity currentActivity = GetTestCaseFromActivityGroup(activGroup); ACL_Data_Contract.Attachment reportAttachment = new ACL_Data_Contract.Attachment(); string activityGroupName = PathHelper.CleanInValidPathChars(activGroup.Name); if ((activGroup.TempReportFolder != null) && (activGroup.TempReportFolder != string.Empty) && (System.IO.Directory.Exists(activGroup.TempReportFolder))) { //Creating the Zip file - start string targetZipPath = System.IO.Directory.GetParent(activGroup.TempReportFolder).ToString(); string zipFileName = targetZipPath + "\\" + activityGroupName.ToString().Replace(" ", "_") + "_GingerHTMLReport.zip"; if (!System.IO.File.Exists(zipFileName)) { ZipFile.CreateFromDirectory(activGroup.TempReportFolder, zipFileName); } else { System.IO.File.Delete(zipFileName); ZipFile.CreateFromDirectory(activGroup.TempReportFolder, zipFileName); } System.IO.Directory.Delete(activGroup.TempReportFolder, true); //Creating the Zip file - finish //Attaching Zip file - start reportAttachment.ClientFileName = activityGroupName.ToString().Replace(" ", "_") + "_GingerHTMLReport.zip"; reportAttachment.ServerLocation = targetZipPath + @"\" + reportAttachment.ClientFileName; reportAttachment.CreatedBy = Environment.UserName; currentActivity.EntityId = Convert.ToInt32(GetExportedIDString(activGroup.ExternalID.ToString(), "RQMID")); currentActivity.ExportedID = (long)currentActivity.EntityId; currentActivity.ActivityData.AttachmentsColl = new Attachments(); currentActivity.ActivityData.AttachmentsColl.Add(reportAttachment); string exportJarFilePath = Assembly.GetExecutingAssembly().Location.Replace(@"GingerCore.dll", "") + @"ALM\\RQM\\JAVA"; RQMConnect.Instance.RQMRep.UploadAttachmetToRQMAndGetIds(loginData, RQMCore.ALMProjectGuid, ALMCore.DefaultAlmConfig.ALMProjectName, RQMCore.ALMProjectGroupName, currentActivity, exportJarFilePath); RQMConnect.Instance.RQMRep.UpdateTestCaseWithNewAttachmentID(loginData, RQMCore.ALMProjectGuid, ALMCore.DefaultAlmConfig.ALMProjectName, RQMCore.ALMProjectGroupName, currentActivity); //Attaching Zip file - finish System.IO.File.Delete(zipFileName); } } catch { Reporter.ToLog(eLogLevel.ERROR, "Failed to attach report Per ActivityGroup - " + activGroup.Name); } } } } catch (Exception e) { resultInfo.ErrorCode = 1; result = e.ToString(); } if (resultInfo.ErrorCode == 0) { result = "Export execution details to RQM performed successfully."; return(true); } else { result = resultInfo.ErrorDesc; } Reporter.ToLog(eLogLevel.ERROR, "Failed to export execution details to RQM/ALM"); return(false); }
public void RunSetStart(string execResultsFolder, long maxFolderSize, DateTime currentExecutionDateTime, bool offline = false) { RunSetReport = new RunSetReport(); if ((WorkSpace.Instance.RunsetExecutor.RunSetConfig.Name != null) && (WorkSpace.Instance.RunsetExecutor.RunSetConfig.Name != string.Empty)) { RunSetReport.Name = WorkSpace.Instance.RunsetExecutor.RunSetConfig.Name; } else { RunSetReport.Name = defaultRunTabLogName; } RunSetReport.Description = WorkSpace.Instance.RunsetExecutor.RunSetConfig.Description; RunSetReport.GUID = WorkSpace.Instance.RunsetExecutor.RunSetConfig.Guid.ToString(); RunSetReport.StartTimeStamp = DateTime.Now.ToUniversalTime(); RunSetReport.Watch.Start(); mExecutionLogger.SetRunsetFolder(execResultsFolder, maxFolderSize, currentExecutionDateTime, offline); if (!offline) { ExecutionProgressReporterListener.AddExecutionDetailsToLog(ExecutionProgressReporterListener.eExecutionPhase.Start, GingerDicser.GetTermResValue(eTermResKey.RunSet), WorkSpace.Instance.RunsetExecutor.RunSetConfig.Name, null); } }
public void InitRunner(GingerRunner runner) { //Configure Runner for execution runner.Status = eRunStatus.Pending; ConfigureRunnerForExecution(runner); //Set the Apps agents foreach (ApplicationAgent appagent in runner.ApplicationAgents.ToList()) { if (appagent.AgentName != null) { ObservableList <Agent> agents = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Agent>(); appagent.Agent = (from a in agents where a.Name == appagent.AgentName select a).FirstOrDefault(); } } //Load the biz flows ObservableList <BusinessFlow> runnerFlows = new ObservableList <BusinessFlow>(); foreach (BusinessFlowRun businessFlowRun in runner.BusinessFlowsRunList.ToList()) { ObservableList <BusinessFlow> businessFlows = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <BusinessFlow>(); BusinessFlow businessFlow = (from x in businessFlows where x.Guid == businessFlowRun.BusinessFlowGuid select x).FirstOrDefault(); //Fail over to try and find by name if (businessFlow == null) { businessFlow = (from x in businessFlows where x.Name == businessFlowRun.BusinessFlowName select x).FirstOrDefault(); } if (businessFlow == null) { Reporter.ToLog(eLogLevel.ERROR, string.Format("Can not find the '{0}' {1} for the '{2}' {3}", businessFlowRun.BusinessFlowName, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), mRunSetConfig.Name, GingerDicser.GetTermResValue(eTermResKey.RunSet))); continue; } else { // Very slow BusinessFlow BFCopy = (BusinessFlow)businessFlow.CreateCopy(false); BFCopy.ContainingFolder = businessFlow.ContainingFolder; BFCopy.Reset(); BFCopy.Active = businessFlowRun.BusinessFlowIsActive; BFCopy.Mandatory = businessFlowRun.BusinessFlowIsMandatory; if (businessFlowRun.BusinessFlowInstanceGuid == Guid.Empty) { BFCopy.InstanceGuid = Guid.NewGuid(); } else { BFCopy.InstanceGuid = businessFlowRun.BusinessFlowInstanceGuid; } if (businessFlowRun.BusinessFlowCustomizedRunVariables != null && businessFlowRun.BusinessFlowCustomizedRunVariables.Count > 0) { ObservableList <VariableBase> allBfVars = BFCopy.GetBFandActivitiesVariabeles(true); Parallel.ForEach(businessFlowRun.BusinessFlowCustomizedRunVariables, customizedVar => { VariableBase originalVar = allBfVars.Where(v => v.ParentGuid == customizedVar.ParentGuid && v.Guid == customizedVar.Guid).FirstOrDefault(); if (originalVar == null)//for supporting dynamic run set XML in which we do not have GUID { originalVar = allBfVars.Where(v => v.ParentName == customizedVar.ParentName && v.Name == customizedVar.Name).FirstOrDefault(); if (originalVar == null) { originalVar = allBfVars.Where(v => v.Name == customizedVar.Name).FirstOrDefault(); } } if (originalVar != null) { CopyCustomizedVariableConfigurations(customizedVar, originalVar); } else { originalVar.DiffrentFromOrigin = false; originalVar.MappedOutputVariable = null; } }); } BFCopy.RunDescription = businessFlowRun.BusinessFlowRunDescription; BFCopy.BFFlowControls = businessFlowRun.BFFlowControls; runnerFlows.Add(BFCopy); } } runner.IsUpdateBusinessFlowRunList = true; runner.BusinessFlows = runnerFlows; }
public void RunSetEnd(string LogFolder = null, bool offline = false) { if (RunSetReport != null) { mExecutionLogger.SetReportRunSet(RunSetReport, LogFolder); // AddExecutionDetailsToLog(eExecutionPhase.End, "Run Set", RunSetReport.Name, RunSetReport); if (WorkSpace.Instance.RunningInExecutionMode) { //Amdocs.Ginger.CoreNET.Execution.eRunStatus.TryParse(RunSetReport.RunSetExecutionStatus, out App.RunSetExecutionStatus);//saving the status for determin Ginger exit code WorkSpace.Instance.RunsetExecutor.RunSetExecutionStatus = RunSetReport.RunSetExecutionStatus; } if (WorkSpace.Instance.RunsetExecutor.RunSetConfig.LastRunsetLoggerFolder != null && WorkSpace.Instance.RunsetExecutor.RunSetConfig.LastRunsetLoggerFolder.Equals("-1")) { WorkSpace.Instance.RunsetExecutor.RunSetConfig.LastRunsetLoggerFolder = RunSetReport.LogFolder; } //App.RunPage.RunSetConfig.LastRunsetLoggerFolder = RunSetReport.LogFolder; if (!offline) { ExecutionProgressReporterListener.AddExecutionDetailsToLog(ExecutionProgressReporterListener.eExecutionPhase.End, GingerDicser.GetTermResValue(eTermResKey.RunSet), WorkSpace.Instance.RunsetExecutor.RunSetConfig.Name, RunSetReport); } if (RunSetReport.RunSetExecutionStatus != Amdocs.Ginger.CoreNET.Execution.eRunStatus.Stopped) { RunSetReport = null; } } }
public static void LoadStatusMsgsPool() { //Initialize the pool Reporter.StatusMsgsPool = new Dictionary <eStatusMsgKey, StatusMsg>(); //Add To Status messages to the pool #region General Application Messages // FIXME not available outside amdocs Reporter.StatusMsgsPool.Add(eStatusMsgKey.RecommendNewVersion, new StatusMsg(eStatusMsgType.INFO, "Upgrade Required", "Newer version of Ginger exist." + System.Environment.NewLine + "You can download the latest version from https://ginger.amdocs.com/", true, "Upgrade")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.NewVersionAvailable, new StatusMsg(eStatusMsgType.INFO, "New version ({0}) is available", "Newer version of Ginger is available." + System.Environment.NewLine + "You can download the latest version from https://ginger.amdocs.com/", true, "Upgrade")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.SaveItem, new StatusMsg(eStatusMsgType.PROCESS, "Saving", "Saving '{0}' {1}")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.RenameItem, new StatusMsg(eStatusMsgType.PROCESS, "Renaming", "Renaming all the references of '{0}' to '{1}'")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.ExitMode, new StatusMsg(eStatusMsgType.INFO, "Oops...", "Ginger was not closed properly. Please turn to support team.")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.ExportItem, new StatusMsg(eStatusMsgType.PROCESS, "Exporting", "Exporting '{0}' {1}")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.StaticStatusMessage, new StatusMsg(eStatusMsgType.INFO, "Message", "{0}")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.StaticStatusProcess, new StatusMsg(eStatusMsgType.PROCESS, "Process", "{0}")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.PasteProcess, new StatusMsg(eStatusMsgType.PROCESS, "Paste", "{0}")); #endregion General Application Messages #region Solution Messages Reporter.StatusMsgsPool.Add(eStatusMsgKey.GetLatestSolution, new StatusMsg(eStatusMsgType.PROCESS, "Get Latest Solution", "Getting the latest updates of '{0}' Solution")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.NoDirtyItem, new StatusMsg(eStatusMsgType.PROCESS, "Save All", "No Unsaved item found.")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.LoadingSolution, new StatusMsg(eStatusMsgType.PROCESS, "Loading Solution", "{0}")); #endregion Solution Messages #region Analyzer Reporter.StatusMsgsPool.Add(eStatusMsgKey.AnalyzerFixingIssues, new StatusMsg(eStatusMsgType.PROCESS, "Auto Fixing Issues", "Fixing the item '{0}'")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.AnalyzerSavingFixedIssues, new StatusMsg(eStatusMsgType.PROCESS, "Saving Auto Fixed Issues", "Saving the item '{0}'")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.AnalyzerIsAnalyzing, new StatusMsg(eStatusMsgType.PROCESS, "Analyzing...", "Analyzing the '{0}' {1} before execution")); #endregion Analyzer #region Agents Messages Reporter.StatusMsgsPool.Add(eStatusMsgKey.StartAgent, new StatusMsg(eStatusMsgType.PROCESS, "Starting Agent", "Starting the agent '{0}' for '{1}'")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.StartAgents, new StatusMsg(eStatusMsgType.PROCESS, "Starting Agent/s", "Starting the agent/s:{0}")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.CreateAgentTip, new StatusMsg(eStatusMsgType.INFO, "Tip!", "Create a new 'Agent' which match to your " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " platform to allow platform connection")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.MainframeIncorrectConfiguration, new StatusMsg(eStatusMsgType.INFO, "Mainframe Server not Available", "Mainframe server is not available on configured address and port . Please Check configuration")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.StartAgentFailed, new StatusMsg(eStatusMsgType.INFO, "Start Agent Failed", "'{0}'")); #endregion Agents Messages #region BusinessFlows Messages Reporter.StatusMsgsPool.Add(eStatusMsgKey.CreateBusinessFlowTip, new StatusMsg(eStatusMsgType.INFO, "Tip!", "Start automating by creating a new '" + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + "' and shifting to the 'Automate' tab")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.BusinessFlowConversion, new StatusMsg(eStatusMsgType.PROCESS, "Converting Actions", "Converting the Actions of the '{0}' " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow))); Reporter.StatusMsgsPool.Add(eStatusMsgKey.CleaningLegacyActions, new StatusMsg(eStatusMsgType.PROCESS, "Cleaning Legacy Actions", "Cleaning Legacy Actions...")); #endregion BusinessFlows Messages #region Execution Messages Reporter.StatusMsgsPool.Add(eStatusMsgKey.CreatingReport, new StatusMsg(eStatusMsgType.PROCESS, "Creating Report", "Creating report for the '{0}' " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " execution")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.LoadingRunSet, new StatusMsg(eStatusMsgType.PROCESS, "Loading " + GingerDicser.GetTermResValue(eTermResKey.RunSet), "Loading Ginger {0}")); #endregion Execution Messages #region Import/Export Messages Reporter.StatusMsgsPool.Add(eStatusMsgKey.ALMTestSetImport, new StatusMsg(eStatusMsgType.PROCESS, "Importing QC/ALM Test Set", "Importing the ALM Test Set: '{0}'")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.ExportItemToALM, new StatusMsg(eStatusMsgType.PROCESS, "Exporting to ALM", "Exporting the item: '{0}'")); #endregion Import/Export Messages #region BusinessFlows Messages Reporter.StatusMsgsPool.Add(eStatusMsgKey.ScriptImported_RefreshSolution, new StatusMsg(eStatusMsgType.INFO, "Tip!", "Refresh the Solution to view the " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " created from UFT Script")); #endregion BusinessFlows Messages #region Shared Repository Messages Reporter.StatusMsgsPool.Add(eStatusMsgKey.AddingToSharedRepository, new StatusMsg(eStatusMsgType.PROCESS, "Adding Item to Repository", "Adding the item: '{0}' to the shared repository ")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.ExportExecutionDetails, new StatusMsg(eStatusMsgType.PROCESS, "Export Execution Details", "Export execution details of the " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + ": '{0}' to {1}.")); #endregion BusinessFlows Messages #region Source Control Reporter.StatusMsgsPool.Add(eStatusMsgKey.CheckInToSourceControl, new StatusMsg(eStatusMsgType.PROCESS, "Check-In to Source Control", "Current Operation: {0}")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.GetLatestFromSourceControl, new StatusMsg(eStatusMsgType.PROCESS, "Get Latest from Source Control", "Updating local solution files to the latest version.")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.DownloadSolutionFromSourceControl, new StatusMsg(eStatusMsgType.PROCESS, "Download Solution", "Downloading the solution '{0}' from source control.")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.ResolveSourceControlConflicts, new StatusMsg(eStatusMsgType.PROCESS, "Resolve Source Control Conflicts", "Resolving local solution conflicts.")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.RevertChangesFromSourceControl, new StatusMsg(eStatusMsgType.PROCESS, "Revert Changes from Source Control", "Undo local changes and revert to source.")); #endregion Source Control #region General Reporter.StatusMsgsPool.Add(eStatusMsgKey.UndoChanges, new StatusMsg(eStatusMsgType.PROCESS, "Undo Changes", "Undo changes for the item '{0}'")); #endregion General Reporter.StatusMsgsPool.Add(eStatusMsgKey.RunCompleted, new StatusMsg(eStatusMsgType.INFO, GingerDicser.GetTermResValue(eTermResKey.RunSet), "Execution Completed '{0}'")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.ExecutingRunSetAction, new StatusMsg(eStatusMsgType.PROCESS, "Executing " + GingerDicser.GetTermResValue(eTermResKey.RunSet) + "Action", "Executing '{0}'")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.StartingRecorder, new StatusMsg(eStatusMsgType.INFO, "Driver", "Starting Recorder")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.StoppingRecorder, new StatusMsg(eStatusMsgType.INFO, "Driver", "Stopping Recorder")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.ASCFTryToConnect, new StatusMsg(eStatusMsgType.INFO, "ASCF Driver", "Trying to connect #{0}")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.JavaDRiverTryToConnect, new StatusMsg(eStatusMsgType.INFO, "Java Driver", "Trying to connect #{0}")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.ShowBetaFeatures, new StatusMsg(eStatusMsgType.INFO, "Show beta Features is: ", "{0}")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.GingerHelpLibrary, new StatusMsg(eStatusMsgType.INFO, "Ginger Help Library is Ready!", "Press [F1] from anywhere and view User Guides & Videos related to the topic you working on!")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.Search, new StatusMsg(eStatusMsgType.PROCESS, "Searching...", "Searching {0}...")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.DownloadingMissingPluginPackages, new StatusMsg(eStatusMsgType.PROCESS, "Restoring Missing Plugins Packages", "Restoring Missing Plugin Packages...")); Reporter.StatusMsgsPool.Add(eStatusMsgKey.GingerLoadingInfo, new StatusMsg(eStatusMsgType.PROCESS, "loading", "{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 = mExecutionLogger.SetExecutionLogFolder(mExecutionLogger.ExecutionLogfolder, true); // } 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), string.Format("{0} ({1})", businessFlow.Name, businessFlow.InstanceGuid), null); } }
private async void grdMain_CellEditEndingAsync(object sender, DataGridCellEditEndingEventArgs e) { GlobalAppModelParameter CurrentGAMP = null; if (e.Column.Header.ToString() == gridPlaceholderHeader) { CurrentGAMP = (GlobalAppModelParameter)xModelsGlobalParamsGrid.CurrentItem; if (IsParamPlaceholderNameConflict(CurrentGAMP)) { return; } } if (e.Column.SortMemberPath == nameof(GlobalAppModelParameter.PlaceHolder)) { GlobalAppModelParameter selectedGlobalAppModelParameter = (GlobalAppModelParameter)xModelsGlobalParamsGrid.CurrentItem; string NameAfterEdit = selectedGlobalAppModelParameter.PlaceHolder; if (PlaceholderBeforeEdit != NameAfterEdit) { char[] invalidChars = System.IO.Path.GetInvalidPathChars().Where(c => c != '<' && c != '>').ToArray <char>(); if (NameAfterEdit.IndexOfAny(invalidChars) > 0) { System.Text.StringBuilder builder = new System.Text.StringBuilder(); foreach (char value in invalidChars) { builder.Append(value); builder.Append(" "); } Reporter.ToUser(eUserMsgKey.ValueIssue, "Value cannot contain characters like: " + builder); selectedGlobalAppModelParameter.PlaceHolder = PlaceholderBeforeEdit; return; } if (Reporter.ToUser(eUserMsgKey.ParameterUpdate, "The Global Parameter name may be used in Solution items Value Expression, Do you want to automatically update all those Value Expression instances with the parameter name change?") == Amdocs.Ginger.Common.eUserMsgSelection.Yes) { this.Dispatcher.Invoke(() => { xPageGrid.Visibility = Visibility.Collapsed; xUpdatingItemsPnl.Visibility = Visibility.Visible; }); await this.Dispatcher.Invoke(async() => { await Task.Run(() => { UpdateModelGlobalParamVeWithNameChange(PlaceholderBeforeEdit, NameAfterEdit); }); }); this.Dispatcher.Invoke(() => { xUpdatingItemsPnl.Visibility = Visibility.Collapsed; xPageGrid.Visibility = Visibility.Visible; }); Reporter.ToUser(eUserMsgKey.StaticInfoMessage, "Update finished successfully." + Environment.NewLine + "Please do not forget to save all modified " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlows)); } } } }
public override void BusinessFlowEnd(uint eventTime, BusinessFlow businessFlow, bool offlineMode = false) { mContext.BusinessFlow = businessFlow; Object BFR = mExecutionLogger.SetReportBusinessFlow(mContext, offlineMode, ExecutedFrom, this.Configuration.ExecutionLoggerConfigurationIsEnabled); if (this.Configuration.ExecutionLoggerConfigurationIsEnabled) { if (this.ExecutedFrom == Amdocs.Ginger.Common.eExecutedFrom.Automation) { this.ExecutionLogBusinessFlowsCounter = 0; mExecutionLogger.ExecutionLogBusinessFlowsCounter = 0; this.BFCounter = 0; } } if (!offlineMode) { ExecutionProgressReporterListener.AddExecutionDetailsToLog(ExecutionProgressReporterListener.eExecutionPhase.End, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), string.Format("{0} ({1})", businessFlow.Name, businessFlow.InstanceGuid), BFR); } }
public async Task <int> RunRunSetFromCommandLine() { //0- success //1- failure try { Reporter.ToLog(eLogLevel.INFO, "Processing Command Line Arguments"); if (ProcessCommandLineArgs() == false) { Reporter.ToLog(eLogLevel.INFO, "Processing Command Line Arguments failed"); return(1); } AutoLogProxy.UserOperationStart("AutoRunWindow", App.RunsetExecutor.RunSetConfig.Name, App.RunsetExecutor.RunsetExecutionEnvironment.Name); Reporter.ToLog(eLogLevel.INFO, String.Format("########################## Starting {0} Automatic Execution Process ##########################", GingerDicser.GetTermResValue(eTermResKey.RunSet))); Reporter.ToLog(eLogLevel.INFO, string.Format("Loading {0} execution UI elements", GingerDicser.GetTermResValue(eTermResKey.RunSet))); try { App.MainWindow.Hide(); App.AppSplashWindow.Close(); AutoRunWindow RP = new AutoRunWindow(); RP.Show(); } catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, string.Format("Failed loading {0} execution UI elements, aborting execution.", GingerDicser.GetTermResValue(eTermResKey.RunSet)), ex); return(1); } //Running Runset Analyzer to look for issues Reporter.ToLog(eLogLevel.INFO, string.Format("Running {0} Analyzer", GingerDicser.GetTermResValue(eTermResKey.RunSet))); try { //run analyzer int analyzeRes = await App.RunsetExecutor.RunRunsetAnalyzerBeforeRun(true).ConfigureAwait(false); if (analyzeRes == 1) { Reporter.ToLog(eLogLevel.ERROR, string.Format("{0} Analyzer found critical issues with the {0} configurations, aborting execution.", GingerDicser.GetTermResValue(eTermResKey.RunSet))); return(1);//cancel run because issues found } } catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, string.Format("Failed Running {0} Analyzer, still continue execution", GingerDicser.GetTermResValue(eTermResKey.RunSet)), ex); //return 1; } //Execute try { await RunRunsetAsync(); } catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, string.Format("Error occured during the {0} execution.", GingerDicser.GetTermResValue(eTermResKey.RunSet)), ex); return(1); } if (App.RunSetExecutionStatus == Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed)//TODO: improve { return(0); } else { return(1); } } catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, "Un expected error occured during the execution", ex); return(1); } finally { AutoLogProxy.UserOperationEnd(); } }
// fix add to listener/loader class public override void ActivityStart(uint eventTime, Activity activity, bool continuerun = false) { mCurrentActivity = activity; if (this.Configuration.ExecutionLoggerConfigurationIsEnabled) { string ActivityFolder = string.Empty; if ((this.ExecutedFrom == Amdocs.Ginger.Common.eExecutedFrom.Automation) && (Configuration.ExecutionLoggerAutomationTabContext == ExecutionLoggerConfiguration.AutomationTabContext.ActivityRun)) { mExecutionLogger.ExecutionLogfolder = mExecutionLogger.SetExecutionLogFolder(mExecutionLogger.ExecutionLogfolder, true); Configuration.ExecutionLoggerAutomationTabContext = ExecutionLoggerConfiguration.AutomationTabContext.None; } else if ((Configuration.ExecutionLoggerAutomationTabContext == ExecutionLoggerConfiguration.AutomationTabContext.ContinueRun)) { mExecutionLogger.ExecutionLogfolder = mExecutionLogger.SetExecutionLogFolder(mExecutionLogger.ExecutionLogfolder, false); Configuration.ExecutionLoggerAutomationTabContext = ExecutionLoggerConfiguration.AutomationTabContext.None; mCurrentBusinessFlow.ExecutionLogActivityCounter++; ActivityFolder = Path.Combine(mCurrentBusinessFlow.ExecutionLogFolder, mCurrentBusinessFlow.ExecutionLogActivityCounter + " " + folderNameNormalazing(activity.ActivityName)); } else { if (this.ExecutedFrom == eExecutedFrom.Run && continuerun == false) { mCurrentBusinessFlow.ExecutionLogActivityCounter++; } else if (this.ExecutedFrom == eExecutedFrom.Automation && continuerun == false) { mCurrentBusinessFlow.ExecutionLogActivityCounter++; } ActivityFolder = Path.Combine(mCurrentBusinessFlow.ExecutionLogFolder, mCurrentBusinessFlow.ExecutionLogActivityCounter + " " + folderNameNormalazing(activity.ActivityName)); } activity.ExecutionLogFolder = mExecutionLogger.GetLogFolder(ActivityFolder); // TODO: cleanup after all execution move to LiteDB if (mExecutionLogger.ExecutionLogfolder != null) { mExecutionLogger.CreateNewDirectory(Path.Combine(mExecutionLogger.ExecutionLogfolder, ActivityFolder)); } activity.VariablesBeforeExec = activity.Variables.Select(a => a.Name + "_:_" + a.Value + "_:_" + a.Description).ToList(); } ExecutionProgressReporterListener.AddExecutionDetailsToLog(ExecutionProgressReporterListener.eExecutionPhase.Start, GingerDicser.GetTermResValue(eTermResKey.Activity), activity.ActivityName, null); }
public async Task <int> RunRunsetAnalyzerBeforeRun(bool runInSilentMode = false) { if (mRunSetConfig.RunWithAnalyzer) { //check if not including any High or Critical issues before execution Reporter.ToGingerHelper(eGingerHelperMsgKey.AnalyzerIsAnalyzing, null, mRunSetConfig.Name, GingerDicser.GetTermResValue(eTermResKey.RunSet)); try { AnalyzerPage analyzerPage = new AnalyzerPage(); await Task.Run(() => { analyzerPage.Init(App.UserProfile.Solution, mRunSetConfig); analyzerPage.AnalyzeWithoutUI(); }); if (analyzerPage.TotalHighAndCriticalIssues > 0) { if (!runInSilentMode) { Reporter.ToUser(eUserMsgKeys.AnalyzerFoundIssues); analyzerPage.ShowAsWindow(); } return(1);//issues found } } finally { Reporter.CloseGingerHelper(); } } return(0); }
private void SetGridView() { DetailsGrid.Title = "Ginger Automation Coverage"; GridViewDef view = new GridViewDef(GridViewDef.DefaultViewName); view.GridColsView = new ObservableList <GridColView>(); view.GridColsView.Add(new GridColView() { Field = QCManagerReportTestCaseDetails.Fields.TestSetName, Header = "Test Set", WidthWeight = 25, BindingMode = BindingMode.OneWay }); view.GridColsView.Add(new GridColView() { Field = QCManagerReportTestCaseDetails.Fields.TestCaseName, Header = "Test Case", WidthWeight = 25, BindingMode = BindingMode.OneWay }); view.GridColsView.Add(new GridColView() { Field = QCManagerReportTestCaseDetails.Fields.ActivitiesGroupName, Header = "Matching " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup), WidthWeight = 25, BindingMode = BindingMode.OneWay }); view.GridColsView.Add(new GridColView() { Field = QCManagerReportTestCaseDetails.Fields.ActivitiesGroupAutomationPrecentage, Header = "Automation Coverage", HorizontalAlignment = System.Windows.HorizontalAlignment.Center, WidthWeight = 20, BindingMode = BindingMode.OneWay }); view.GridColsView.Add(new GridColView() { Field = QCManagerReportTestCaseDetails.Fields.NumberOfExecutions, Header = "Executions Count.", HorizontalAlignment = System.Windows.HorizontalAlignment.Center, WidthWeight = 20, BindingMode = BindingMode.OneWay }); view.GridColsView.Add(new GridColView() { Field = QCManagerReportTestCaseDetails.Fields.PassRate, Header = "Pass Rate", HorizontalAlignment = System.Windows.HorizontalAlignment.Center, WidthWeight = 20, BindingMode = BindingMode.OneWay }); view.GridColsView.Add(new GridColView() { Field = QCManagerReportTestCaseDetails.Fields.LastExecutionTime, Header = "Last Execution Time", HorizontalAlignment = System.Windows.HorizontalAlignment.Center, WidthWeight = 20, BindingMode = BindingMode.OneWay }); view.GridColsView.Add(new GridColView() { Field = QCManagerReportTestCaseDetails.Fields.LastExecutionStatus, Header = "Last Execution Status", HorizontalAlignment = System.Windows.HorizontalAlignment.Center, WidthWeight = 20, BindingMode = BindingMode.OneWay }); DetailsGrid.SetAllColumnsDefaultView(view); //# Custom Views GridViewDef coverageView = new GridViewDef("Coverage"); coverageView.GridColsView = new ObservableList <GridColView>(); coverageView.GridColsView.Add(new GridColView() { Field = QCManagerReportTestCaseDetails.Fields.NumberOfExecutions, Visible = false }); coverageView.GridColsView.Add(new GridColView() { Field = QCManagerReportTestCaseDetails.Fields.PassRate, Visible = false }); coverageView.GridColsView.Add(new GridColView() { Field = QCManagerReportTestCaseDetails.Fields.LastExecutionTime, Visible = false }); coverageView.GridColsView.Add(new GridColView() { Field = QCManagerReportTestCaseDetails.Fields.LastExecutionStatus, Visible = false }); DetailsGrid.AddCustomView(coverageView); GridViewDef executionView = new GridViewDef("Execution"); executionView.GridColsView = new ObservableList <GridColView>(); executionView.GridColsView.Add(new GridColView() { Field = QCManagerReportTestCaseDetails.Fields.ActivitiesGroupName, Visible = false }); executionView.GridColsView.Add(new GridColView() { Field = QCManagerReportTestCaseDetails.Fields.ActivitiesGroupAutomationPrecentage, Visible = false }); DetailsGrid.AddCustomView(executionView); DetailsGrid.InitViewItems(); DetailsGrid.ShowViewCombo = System.Windows.Visibility.Collapsed; DetailsGrid.DataSourceList = mTestCaseDetailsList; }