Exemplo n.º 1
0
        public void ShowAsWindow(Window ownerWindow, eWindowShowStyle windowStyle = eWindowShowStyle.Dialog, ePageViewMode viewMode = ePageViewMode.Selection)
        {
            ObservableList <Button> winButtons = new ObservableList <Button>();

            if (viewMode == ePageViewMode.Selection)
            {
                Button addButton = new Button();
                addButton.Content = "Add Selected";
                addButton.Click  += SendSelected;

                winButtons.Add(addButton);
                xActivitiesRepositoryGrid.AddHandler(DataGridRow.MouseDoubleClickEvent, new RoutedEventHandler(SendSelected));
            }

            GingerCore.General.LoadGenericWindow(ref _pageGenericWin, ownerWindow, windowStyle, "Shared " + GingerDicser.GetTermResValue(eTermResKey.Activities), this, winButtons, true, "Close");
        }
Exemplo n.º 2
0
        private void GeneratBFButton_Click(object sender, RoutedEventArgs e)
        {
            if (!isBFexists)
            {
                BusinessFlowsFolderTreeItem bfsFolder = new BusinessFlowsFolderTreeItem(WorkSpace.Instance.SolutionRepository.GetRepositoryItemRootFolder <BusinessFlow>(), eBusinessFlowsTreeViewMode.ReadOnly);

                bfsFolder.IsGingerDefualtFolder = true;
                SingleItemTreeViewSelectionPage mTargetFolderSelectionPage = new SingleItemTreeViewSelectionPage(GingerDicser.GetTermResValue(eTermResKey.BusinessFlows), eImageType.BusinessFlow, bfsFolder, SingleItemTreeViewSelectionPage.eItemSelectionType.Folder, true);

                List <object> selectedBfs = mTargetFolderSelectionPage.ShowAsWindow();
                if (selectedBfs != null)
                {
                    targetBFFolder = (RepositoryFolder <BusinessFlow>)((ITreeViewItem)selectedBfs[0]).NodeObject();
                }
                CreateNewBF(FeatureName);
                CreateActivities();
                WorkSpace.Instance.SolutionRepository.SaveRepositoryItem(mBizFlow);
                if (genWin != null)
                {
                    genWin.Close();
                }
                UpdateBFButton.Content = "Update " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow);
                isBFexists             = true;
                Reporter.ToUser(eUserMsgKey.BusinessFlowUpdate, mBizFlow.ContainingFolder + "\\" + mBizFlow.Name, "Created");
            }
            else
            {
                UpdateBFButton_Click();
                Reporter.ToUser(eUserMsgKey.BusinessFlowUpdate, mBizFlow.ContainingFolder + "\\" + mBizFlow.Name, "Updated");
            }

            GherkinTextEditor.SetContentEditorTitleLabel(Path.GetFileName(GherkinTextEditor.FileName) + " , Target " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + ": " + mBizFlow.ContainingFolder + "\\" + mBizFlow.Name, (Style)TryFindResource("@ucGridTitleLightStyle"));

            //if(App.BusinessFlow == mBizFlow)
            //{
            //    App.BusinessFlow = mBizFlow;
            //    App.BusinessFlow.SaveBackup();
            //}
        }
Exemplo n.º 3
0
 public override void ActionUserRecommendedUseCase(TextBlockHelper TBH)
 {
     TBH.AddText("1- Select the the " + GingerDicser.GetTermResValue(eTermResKey.Variable) + " to modify it value");
     TBH.AddLineBreak();
     TBH.AddText("2- Select the type of operation which required, the options are Reset Value\\Generate Auto Value\\Set Value");
     TBH.AddLineBreak();
     TBH.AddLineBreak();
     TBH.AddText("In case 'Set Value' operation is selected, user is able to configure the value for the " + GingerDicser.GetTermResValue(eTermResKey.Variable) + " (String and List variables type only) using value expression.");
     TBH.AddLineBreak();
     TBH.AddLineBreak();
     TBH.AddText("For List type " + GingerDicser.GetTermResValue(eTermResKey.Variables) + ", the value to set must be one of the " + GingerDicser.GetTermResValue(eTermResKey.Variable) + " possible values.");
     TBH.AddLineBreak();
     TBH.AddLineBreak();
     TBH.AddText("The 'Value' field is relevant only for 'SetValue' operation.");
 }
Exemplo n.º 4
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), businessFlow.Name, null);
            }
        }
Exemplo n.º 5
0
        // 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);
                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);
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        public void RunSetStart(string execResultsFolder, long maxFolderSize, DateTime currentExecutionDateTime, bool offline = false)
        {
            if (RunSetReport == null)
            {
                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);
            }
        }
Exemplo n.º 8
0
        public bool ExportBusinessFlowToRQM(BusinessFlow businessFlow, ObservableList <ExternalItemFieldBase> ExternalItemsFields, ref string result)
        {
            mExternalItemsFields = ExternalItemsFields;
            LoginDTO loginData = new LoginDTO()
            {
                User = ALMCore.AlmConfig.ALMUserName, Password = ALMCore.AlmConfig.ALMPassword, Server = ALMCore.AlmConfig.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.AlmConfig.ALMServerURL, RQMCore.ALMProjectGuid, ALMCore.AlmConfig.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);
            }
        }
Exemplo n.º 9
0
        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.AlmConfig.ALMUserName, Password = ALMCore.AlmConfig.ALMPassword, Server = ALMCore.AlmConfig.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.AlmConfig.ALMProjectName || x.Name == "DefaultProjectName").FirstOrDefault();
                    if (currentRQMProjectMapping != null)
                    {
                        testPlan = RQMConnect.Instance.GetRQMTestPlanByIdByProject(ALMCore.AlmConfig.ALMServerURL, ALMCore.AlmConfig.ALMUserName, ALMCore.AlmConfig.ALMPassword, ALMCore.AlmConfig.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.AlmConfig.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.AlmConfig.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";
                                resultInfo = RQMConnect.Instance.RQMRep.UploadAttachmetToRQMAndGetIds(loginData, RQMCore.ALMProjectGuid, ALMCore.AlmConfig.ALMProjectName, RQMCore.ALMProjectGroupName, currentActivity, exportJarFilePath);

                                resultInfo = RQMConnect.Instance.RQMRep.UpdateTestCaseWithNewAttachmentID(loginData, RQMCore.ALMProjectGuid, ALMCore.AlmConfig.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);
        }
Exemplo n.º 10
0
        public void WizardEvent(WizardEventArgs WizardEventArgs)
        {
            switch (WizardEventArgs.EventType)
            {
            case EventType.Init:
                mConversionProcess = (IActionsConversionProcess)WizardEventArgs.Wizard;
                ((WizardWindow)((WizardBase)mConversionProcess).mWizardWindow).ShowFinishButton(false);
                SetGridsView();
                break;

            case EventType.LeavingForNextPage:
                if (ListOfBusinessFlow.Where(x => x.IsSelected && x.TotalProcessingActionsCount > 0).ToList().Count == 0)
                {
                    Reporter.ToUser(eUserMsgKey.StaticWarnMessage, string.Format("Please select {0} which contains legacy Actions to convert.", GingerDicser.GetTermResValue(eTermResKey.BusinessFlows)));
                    WizardEventArgs.CancelEvent = true;
                    return;
                }
                else
                {
                    PrepareBFsForConversion();
                }
                break;
            }
        }
Exemplo n.º 11
0
        private ExecutionResult GetExeResultforAg(BusinessFlow businessFlow, string bfExportedID, ActivitiesGroup activGroup, ref string result, RQMTestPlan testPlan)
        {
            try
            {
                LoginDTO loginData = new LoginDTO()
                {
                    User = ALMCore.AlmConfig.ALMUserName, Password = ALMCore.AlmConfig.ALMPassword, Server = ALMCore.AlmConfig.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.AlmConfig.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.AlmConfig.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.AlmConfig.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);
            }
        }
Exemplo n.º 12
0
        public override void AddTreeItem()
        {
            //TODO: change to wizard
            string BizFlowName = string.Empty;

            if (GingerCore.General.GetInputWithValidation("Add " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " Name:", ref BizFlowName))
            {
                BusinessFlow BizFlow = App.GetNewBusinessFlow(BizFlowName);

                if (WorkSpace.UserProfile.Solution.ApplicationPlatforms.Count != 1)
                {
                    EditBusinessFlowAppsPage EBFP = new EditBusinessFlowAppsPage(BizFlow, true);
                    EBFP.ResetPlatformSelection();
                    EBFP.Title = "Configure " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " Target Application(s)";
                    EBFP.ShowAsWindow(eWindowShowStyle.Dialog, false);
                }
                else
                {
                    BizFlow.TargetApplications.Add(new TargetApplication()
                    {
                        AppName = WorkSpace.UserProfile.Solution.MainApplication
                    });
                    BizFlow.CurrentActivity.TargetApplication = BizFlow.TargetApplications[0].Name;
                }

                mBusFlowsFolder.AddRepositoryItem(BizFlow);
            }
        }
Exemplo n.º 13
0
        private void ImportExternalBuinessFlow(object sender, System.Windows.RoutedEventArgs e)
        {
            BusinessFlow importedBF = null;

            //open dialog for selecting the BF file
            System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
            dlg.DefaultExt = ".Ginger.BusinessFlow.xml";
            dlg.Filter     = "Ginger Business Flow File|*.Ginger.BusinessFlow.xml";
            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    //copy to Solution Business Flow folder
                    string importedBFpath = System.IO.Path.Combine(mBusFlowsFolder.FolderFullPath, System.IO.Path.GetFileName(dlg.FileName));
                    File.Copy(dlg.FileName, importedBFpath, false);

                    //load it to object
                    importedBF = (BusinessFlow)RepositoryItem.LoadFromFile(typeof(BusinessFlow), importedBFpath);

                    //customize the imported BF
                    importedBF.Guid = Guid.NewGuid();
                    for (int i = 0; i < importedBF.TargetApplications.Count; i++)
                    {
                        if (WorkSpace.UserProfile.Solution.ApplicationPlatforms.Where(x => x.AppName == importedBF.TargetApplications[i].Name).FirstOrDefault() == null)
                        {
                            importedBF.TargetApplications.RemoveAt(i);//No such Application so Delete it
                            i--;
                        }
                    }
                    if (importedBF.TargetApplications.Count == 0)
                    {
                        TargetApplication ta = new TargetApplication();
                        ta.AppName = WorkSpace.UserProfile.Solution.ApplicationPlatforms[0].AppName;
                        importedBF.TargetApplications.Add(ta);
                    }

                    WorkSpace.Instance.SolutionRepository.SaveRepositoryItem(importedBF);
                    mBusFlowsFolder.AddRepositoryItem(importedBF);
                }
                catch (Exception ex)
                {
                    Reporter.ToUser(eUserMsgKey.StaticErrorMessage, "Failed to copy and load the selected " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " file." + System.Environment.NewLine + "Error: " + System.Environment.NewLine + ex.Message);
                    return;
                }
            }
        }
Exemplo n.º 14
0
        void ITreeViewItem.SetTools(ITreeView TV)
        {
            mTreeView    = TV;
            mContextMenu = new ContextMenu();

            if (mTreeView.Tree.TreeChildFolderOnly == true)
            {
                AddFolderNodeBasicManipulationsOptions(mContextMenu, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), true, false, false, false, false, false, false, true, false, false);
            }
            else if (mViewMode == eBusinessFlowsTreeViewMode.ReadWrite)
            {
                if (mBusFlowsFolder.IsRootFolder)
                {
                    AddFolderNodeBasicManipulationsOptions(mContextMenu, nodeItemTypeName: GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), allowRenameFolder: false, allowDeleteFolder: false, allowRefresh: false);
                }
                else
                {
                    AddFolderNodeBasicManipulationsOptions(mContextMenu, nodeItemTypeName: GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), allowRefresh: false);
                }
                AddSourceControlOptions(mContextMenu, false, false);

                MenuItem importMenu = TreeViewUtils.CreateSubMenu(mContextMenu, "Import");
                TreeViewUtils.AddSubMenuItem(importMenu, "Import External " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), ImportExternalBuinessFlow, null, eImageType.ImportFile);
                TreeViewUtils.AddSubMenuItem(importMenu, "Import ALM Test Set", ALMTSImport, null, "@ALM_16x16.png");
                TreeViewUtils.AddSubMenuItem(importMenu, "Import ALM Test Set By ID", ALMTSImportById, null, "@ALM_16x16.png");
                TreeViewUtils.AddSubMenuItem(importMenu, "Import Gherkin Feature File", ImportGherkinFeature, null, "@FeatureFile_16X16.png");
                //TreeViewUtils.AddSubMenuItem(importMenu, "Import Selenium Script", ImportSeleniumScript, null, eImageType.ImportFile);
                //TreeViewUtils.AddSubMenuItem(importMenu, "Import QTP Script", ImportAQTPScript, null, eImageType.ImportFile);
                //TreeViewUtils.AddSubMenuItem(importMenu, "Import ASAP Script", ImportASAPScript, null, eImageType.ImportFile);
                MenuItem exportMenu = TreeViewUtils.CreateSubMenu(mContextMenu, "Export");
                TreeViewUtils.AddSubMenuItem(exportMenu, "Export All to ALM", ExportAllToALM, null, "@ALM_16x16.png");
            }
            else
            {
                AddFolderNodeBasicManipulationsOptions(mContextMenu, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), false, false, false, false, false, false, false, false, false, false);
            }
        }
Exemplo n.º 15
0
        public bool PrepareRunsetForExecution()
        {
            try
            {
                Reporter.ToLog(eLogLevel.INFO, string.Format("Preparing {0} for Execution", GingerDicser.GetTermResValue(eTermResKey.RunSet)));

                if (!ShowAutoRunWindow)
                {
                    Reporter.ToLog(eLogLevel.INFO, string.Format("Loading {0} Runners", GingerDicser.GetTermResValue(eTermResKey.RunSet)));
                    mRunsetExecutor.InitRunners();
                }

                if (mRunSetConfig.RunWithAnalyzer)
                {
                    Reporter.ToLog(eLogLevel.INFO, string.Format("Running {0} Analyzer", GingerDicser.GetTermResValue(eTermResKey.RunSet)));
                    AnalyzerUtils analyzerUtils = new AnalyzerUtils();
                    if (analyzerUtils.AnalyzeRunset(mRunSetConfig, true))
                    {
                        Reporter.ToLog(eLogLevel.WARN, string.Format("Stopping {0} execution due to Analyzer issues", GingerDicser.GetTermResValue(eTermResKey.RunSet)));
                        return(false);
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                Reporter.ToLog(eLogLevel.ERROR, string.Format("Unexpected error occurred while preparing {0} for Execution", GingerDicser.GetTermResValue(eTermResKey.RunSet)), ex);
                return(false);
            }
        }
Exemplo n.º 16
0
        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.UserProfile.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);
        }
Exemplo n.º 17
0
        private void SelectRunset()
        {
            Reporter.ToLog(eLogLevel.INFO, string.Format("Selected {0}: '{1}'", GingerDicser.GetTermResValue(eTermResKey.RunSet), Runset));
            ObservableList <RunSetConfig> RunSets = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <RunSetConfig>();

            mRunSetConfig = RunSets.Where(x => x.Name.ToLower().Trim() == Runset.ToLower().Trim()).FirstOrDefault();
            if (mRunSetConfig != null)
            {
                mRunsetExecutor.RunSetConfig = mRunSetConfig;
            }
            else
            {
                Reporter.ToLog(eLogLevel.ERROR, string.Format("Failed to find matching {0} in the Solution", GingerDicser.GetTermResValue(eTermResKey.RunSet)));
                Reporter.ToUser(eUserMsgKey.CannotRunShortcut);
                // TODO: throw
                // return false;
            }
        }
Exemplo n.º 18
0
        public static List <AnalyzerItemBase> Analyze(GingerRunner GR, BusinessFlow BusinessFlow)
        {
            List <AnalyzerItemBase> IssuesList = new List <AnalyzerItemBase>();

            //code added to analyze for BFFlowControls in Runner BF.
            if (BusinessFlow.BFFlowControls.Count > 0)
            {
                foreach (FlowControl f in BusinessFlow.BFFlowControls)
                {
                    if (f.Active == true)
                    {
                        if (f.BusinessFlowControlAction == eBusinessFlowControlAction.GoToBusinessFlow)
                        {
                            string       GoToBusinessFlow = f.GetNameFromValue();
                            BusinessFlow bf           = null;
                            Guid         guidToLookBy = Guid.Empty;

                            if (!string.IsNullOrEmpty(f.GetGuidFromValue().ToString()))
                            {
                                guidToLookBy = Guid.Parse(f.GetGuidFromValue().ToString());
                            }

                            List <BusinessFlow> lstBusinessFlow = null;
                            if (guidToLookBy != Guid.Empty)
                            {
                                lstBusinessFlow = GR.BusinessFlows.Where(x => x.InstanceGuid == guidToLookBy).ToList();
                            }

                            if (lstBusinessFlow == null || lstBusinessFlow.Count == 0)
                            {
                                bf = null;
                            }
                            else if (lstBusinessFlow.Count == 1)
                            {
                                bf = (BusinessFlow)lstBusinessFlow[0];
                            }
                            else//we have more than 1
                            {
                                BusinessFlow firstActive = (BusinessFlow)lstBusinessFlow.Where(x => x.Active == true).FirstOrDefault();
                                if (firstActive != null)
                                {
                                    bf = firstActive;
                                }
                                else
                                {
                                    bf = (BusinessFlow)lstBusinessFlow[0];//no one is Active so returning the first one
                                }
                            }
                            if (bf == null)
                            {
                                AnalyzeRunnerBusinessFlow ABF = CreateNewIssue(IssuesList, GR, BusinessFlow);
                                ABF.Description = "Flow control is mapped to " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " which does not exist";
                                ABF.Details     = "'" + GoToBusinessFlow + "' " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " does not exist in the '" + GR.Name + " ' " + GingerDicser.GetTermResValue(eTermResKey.RunSet);
                                ABF.HowToFix    = "Remap the Flow Control Action";
                                ABF.IssueType   = eType.Error;
                                ABF.CanAutoFix  = AnalyzerItemBase.eCanFix.No;
                                ABF.Impact      = "Flow Control will fail on run time";
                                ABF.Severity    = eSeverity.High;
                            }
                        }
                        if (f.BusinessFlowControlAction == eBusinessFlowControlAction.SetVariableValue)
                        {
                            if (string.IsNullOrEmpty(f.Value) || ValueExpression.IsThisDynamicVE(f.Value) == false)
                            {
                                string   SetVariableValue = f.GetNameFromValue();
                                string[] vals             = SetVariableValue.Split(new char[] { '=' });
                                if ((BusinessFlow.GetAllHierarchyVariables().Where(x => x.Name == vals[0].Trim()).Select(x => x.Name).FirstOrDefault() == null))
                                {
                                    AnalyzeRunnerBusinessFlow ABF = CreateNewIssue(IssuesList, GR, BusinessFlow);
                                    ABF.Description = "Flow control mapped to " + GingerDicser.GetTermResValue(eTermResKey.Variable) + " which does not exist";;
                                    ABF.Details     = "'" + vals[0].Trim() + "' " + GingerDicser.GetTermResValue(eTermResKey.Variable) + " does not exist in parent items";
                                    ABF.HowToFix    = "Remap the Flow Control Action";
                                    ABF.CanAutoFix  = AnalyzerItemBase.eCanFix.No;
                                    ABF.IssueType   = eType.Error;
                                    ABF.Impact      = "Flow Control will fail on run time";
                                    ABF.Severity    = eSeverity.High;
                                }
                            }
                        }
                    }
                }
            }
            return(IssuesList);
        }
Exemplo n.º 19
0
        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);
            }
        }
Exemplo n.º 20
0
        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);
        }
Exemplo n.º 21
0
        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);
                }
                RunSetReport = null;
            }
        }
Exemplo n.º 22
0
        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);
        }
Exemplo n.º 23
0
        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), businessFlow.Name, BFR);
            }
        }
Exemplo n.º 24
0
        private void xSelectBF_Click(object sender, RoutedEventArgs e)
        {
            RepositoryFolder <BusinessFlow> mBFFolder = WorkSpace.Instance.SolutionRepository.GetRepositoryItemRootFolder <BusinessFlow>();
            BusinessFlowsFolderTreeItem     bFsRoot   = new BusinessFlowsFolderTreeItem(mBFFolder);

            SingleItemTreeViewSelectionPage selectPage = new SingleItemTreeViewSelectionPage(GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " Elements", eImageType.BusinessFlow, bFsRoot,
                                                                                             SingleItemTreeViewSelectionPage.eItemSelectionType.Single, true,
                                                                                             new Tuple <string, string>(nameof(BusinessFlow.Applications), TargetApplication), UCTreeView.eFilteroperationType.Contains);

            List <object> selectedBF = selectPage.ShowAsWindow();

            if (selectedBF != null && selectedBF.Count > 0)
            {
                BusinessFlow = (BusinessFlow)selectedBF[0];
            }
            else
            {
                if (mBusinessFlow == null)
                {
                    xGoToAutomateBtn.Visibility = Visibility.Hidden;
                }
            }
            ElementChangedEvent();
        }
Exemplo n.º 25
0
        // 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);
            }
        }
Exemplo n.º 26
0
        private void SetUIControlsContent()
        {
            mLibraryVarsList   = LoadLibraryVarsList();
            mLibraryVarsHelper = new VariablesListViewHelper(mLibraryVarsList, mVariablesParentObj, mVariablesLevel, mContext, General.eRIPageViewMode.Add);
            mLibraryVarsHelper.AllowExpandItems = false;
            xLibraryTabHeaderText.Text          = string.Format("{0} Library ({1})", GingerDicser.GetTermResValue(eTermResKey.Variables), mLibraryVarsList.Count);
            xLibraryTabListView.SetDefaultListDataTemplate(mLibraryVarsHelper);
            xLibraryTabListView.DataSourceList    = mLibraryVarsList;
            xLibraryTabListView.MouseDoubleClick += XLibraryTabListView_MouseDoubleClick;

            mSharedRepoVarsList           = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <VariableBase>();
            mSharedRepoVarsHelper         = new VariablesListViewHelper(mLibraryVarsList, mVariablesParentObj, mVariablesLevel, mContext, General.eRIPageViewMode.AddFromShardRepository);
            xSharedRepoTabHeaderText.Text = string.Format("Shared Repository {0} ({1})", GingerDicser.GetTermResValue(eTermResKey.Variables), mSharedRepoVarsList.Count);
            xSharedRepoTabListView.SetDefaultListDataTemplate(mSharedRepoVarsHelper);
            xSharedRepoTabListView.DataSourceList    = mSharedRepoVarsList;
            xSharedRepoTabListView.MouseDoubleClick += XSharedRepoTabListView_MouseDoubleClick;
        }
Exemplo n.º 27
0
        public bool Load(string FileName)
        {
            featureFileName = FileName;
            GherkinTextEditor.SetContentEditorTitleLabel(Path.GetFileName(FileName) + " , Target " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + ": N/A", (Style)TryFindResource("@ucGridTitleLightStyle"));
            GherkinDcoumentEditor g = new GherkinDcoumentEditor();

            g.OptimizedSteps = mOptimizedSteps;
            g.OptimizedTags  = mTags;
            GherkinTextEditor.Init(FileName, g, true);
            mSolTags.ClearAll();
            foreach (GherkinTag tag in mTags)
            {
                Guid guid = GetTagInSolution(tag.Name);
                if (guid != Guid.Empty)
                {
                    mSolTags.Add(guid);
                }
            }

            ARP = new ActivitiesRepositoryPage(WorkSpace.Instance.SolutionRepository.GetRepositoryItemRootFolder <Activity>(), null, mSolTags, ArrowButtonHandler);
            ARP.xActivitiesRepositoryGrid.EnableTagsPanel = false;
            SharedActivitiesFrame.Content = ARP;

            BFName = FileName.Replace(WorkSpace.Instance.Solution.Folder, "");
            //to prevent creating a folder rather than putting them on BF level.
            if (BFName.Contains("Business Flows"))
            {
                BFName = BFName.Replace("Business Flows", "");
            }
            if (BFName.EndsWith(".feature"))
            {
                BFName = Path.GetFileName(FileName).Replace(".feature", "");
            }
            // search if we have the BF defined already, so search in BF will work
            string externalID = FileName.Replace(WorkSpace.Instance.Solution.Folder, "~");

            mBizFlow = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <BusinessFlow>().Where(x => x.Source == BusinessFlow.eSource.Gherkin && (x.ExternalID == externalID || x.ExternalID == FileName)).SingleOrDefault();

            if (mBizFlow != null)
            {
                BFName                 = mBizFlow.FileName;
                isBFexists             = true;
                UpdateBFButton.Content = "Update " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow);
                GherkinTextEditor.SetContentEditorTitleLabel(Path.GetFileName(FileName) + " , Target " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + ": " + mBizFlow.ContainingFolder + "\\" + mBizFlow.Name, (Style)TryFindResource("@ucGridTitleLightStyle"));
            }
            else
            {
                isBFexists             = false;
                UpdateBFButton.Content = "Create " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow);
            }
            SavePrompt();

            return(Optimize());
        }
Exemplo n.º 28
0
 public bool LoadRunset(RunsetExecutor runsetExecutor)
 {
     try
     {
         Reporter.ToLog(eLogLevel.INFO, string.Format("Loading {0}", GingerDicser.GetTermResValue(eTermResKey.RunSet)));
         mRunsetExecutor = runsetExecutor;
         if (mRunsetExecutor.RunSetConfig == null)
         {
             SelectRunset();
         }
         else
         {
             mRunSetConfig = mRunsetExecutor.RunSetConfig;
         }
         SelectEnv();
         mRunSetConfig.RunWithAnalyzer = RunAnalyzer;
         HandleAutoRunWindow();
         return(true);
     }
     catch (Exception ex)
     {
         Reporter.ToLog(eLogLevel.ERROR, string.Format("Unexpected error occurred while loading the {0}", GingerDicser.GetTermResValue(eTermResKey.RunSet)), ex);
         return(false);
     }
 }
Exemplo n.º 29
0
        public override void Execute()
        {
            VariableBase Var = RunOnBusinessFlow.GetHierarchyVariableByName(VariableName);

            if (Var == null)
            {
                Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed;
                Error  = GingerDicser.GetTermResValue(eTermResKey.Variable) + " was not found.";
                return;
            }

            if (SetVariableValueOption == eSetValueOptions.SetValue)
            {
                ValueExpression VE = new ValueExpression(RunOnEnvironment, RunOnBusinessFlow, DSList);
                VE.Value = this.Value;

                if (Var.GetType() == typeof(VariableString))
                {
                    ((VariableString)Var).Value = VE.ValueCalculated;
                }
                else if (Var.GetType() == typeof(VariableSelectionList))
                {
                    string calculatedValue = VE.ValueCalculated;
                    if (((VariableSelectionList)Var).OptionalValuesList.Where(pv => pv.Value == calculatedValue).FirstOrDefault() != null)
                    {
                        ((VariableSelectionList)Var).Value = calculatedValue;
                    }
                    else
                    {
                        Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed;
                        Error  = "The value '" + calculatedValue + "' is not part of the possible values of the '" + Var.Name + "' " + GingerDicser.GetTermResValue(eTermResKey.Variable) + ".";
                        return;
                    }
                }
                else if (Var.GetType() == typeof(VariableList))
                {
                    string   calculatedValue = VE.ValueCalculated;
                    string[] possibleVals    = ((VariableList)Var).Formula.Split(',');
                    if (possibleVals != null && possibleVals.Contains(calculatedValue))
                    {
                        ((VariableList)Var).Value = calculatedValue;
                    }
                    else
                    {
                        Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed;
                        Error  = "The value '" + calculatedValue + "' is not part of the possible values of the '" + Var.Name + "' " + GingerDicser.GetTermResValue(eTermResKey.Variable) + ".";
                        return;
                    }
                }
                else if (Var.GetType() == typeof(VariableDynamic))
                {
                    ((VariableDynamic)Var).ValueExpression = VE.Value;
                }
            }
            else if (SetVariableValueOption == eSetValueOptions.ResetValue)
            {
                ((VariableBase)Var).ResetValue();
            }
            else if (SetVariableValueOption == eSetValueOptions.AutoGenerateValue)
            {
                ((VariableBase)Var).GenerateAutoValue();
            }
            else
            {
                Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed;
                Error  = "Unknown set " + GingerDicser.GetTermResValue(eTermResKey.Variable) + " value operation.";
                return;
            }

            ExInfo = GingerDicser.GetTermResValue(eTermResKey.Variable) + " '" + Var.Name + "' value was set to: '" + Var.Value + "'";
        }
Exemplo n.º 30
0
        private void XAddGroupBtn_Click(object sender, RoutedEventArgs e)
        {
            string groupName = string.Empty;

            if (InputBoxWindow.GetInputWithValidation(GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup, "New"), GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup, "New", "Name:"), ref groupName))
            {
                if (!string.IsNullOrEmpty(groupName))
                {
                    if (mWizard.Context.BusinessFlow.ActivitiesGroups.Where(x => x.Name.Trim() == groupName.Trim()).FirstOrDefault() == null)
                    {
                        ActivitiesGroup activitiesGroup = new ActivitiesGroup()
                        {
                            Name = groupName.Trim()
                        };
                        mWizard.Context.BusinessFlow.AddActivitiesGroup(activitiesGroup);
                        xGroupComboBox.SelectedItem = activitiesGroup;
                    }
                    else
                    {
                        Reporter.ToUser(eUserMsgKey.StaticWarnMessage, "Group with same name already exist, please set unique name.");
                    }
                }
            }
        }