Example #1
0
        public override void GetALMTestSetData(ALMTestSet almTestSet)
        {
            try
            {
                //Get Test Set Name
                if (almTestSet.TestSetID != almTestSet.TestSetInternalID2)
                {
                    TreeNode treeNode = ((ZephyrEntCore)ALMIntegration.Instance.AlmCore).GetTestRepositoryFolderById(Convert.ToInt32(almTestSet.TestSetID));
                    if (treeNode != null)
                    {
                        almTestSet.TestSetName = treeNode.name;
                    }
                }
                else
                {
                    List <BaseResponseItem> testSetResponseItems = ((ZephyrEntCore)ALMIntegration.Instance.AlmCore).GetZephyrEntPhaseById(Convert.ToInt32(almTestSet.TestSetID));
                    if (testSetResponseItems is not null && testSetResponseItems.Count > 0)
                    {
                        almTestSet.TestSetName = testSetResponseItems[0].TryGetItem("name").ToString();
                    }
                }

                // Add test cases
                almTestSet = ((ZephyrEntCore)ALMIntegration.Instance.AlmCore).ImportTestSetData(almTestSet);
            }
            catch (Exception ex)
            {
                Reporter.ToLog(eLogLevel.ERROR, $"Failed to get Test Set data, {System.Reflection.MethodBase.GetCurrentMethod().Name}: Error - {ex.Message} ");
            }
        }
        public override Dictionary <string, string> GetTaskProperties()
        {
            LauncherParamsBuilder builder = new LauncherParamsBuilder();

            builder.SetRunType(RunType.AlmLabManagement);
            builder.SetAlmServerUrl(ALMServerPath);
            builder.SetAlmUserName(ALMUserName);
            builder.SetAlmPassword(ALMPassword);
            builder.SetAlmDomain(ALMDomain);
            builder.SetAlmProject(ALMProject);
            builder.SetBuildNumber(BuildNumber);

            switch (TestRunType)
            {
            case "testSet":
                builder.SetTestRunType(RunTestType.TEST_SUITE);
                break;

            case "buildVerificationSuite":
                builder.SetTestRunType(RunTestType.BUILD_VERIFICATION_SUITE);
                break;
            }

            if (!string.IsNullOrEmpty(ALMTestSet))
            {
                int i = 1;
                foreach (string testSet in ALMTestSet.Split('\n'))
                {
                    builder.SetTestSet(i++, testSet.Replace(@"\", @"\\"));
                }
            }
            else
            {
                builder.SetAlmTestSet("");
            }


            if (UseCDA)
            {
                builder.SetDeploymentAction(DeploymentAction);
                builder.SetDeployedEnvironmentName(DeploymentEnvironmentName);
                builder.SetDeprovisioningAction(DeprovisioningAction);
            }

            //set ALM mandatory parameters
            builder.SetAlmTimeout(TimeslotDuration);
            builder.SetAlmRunMode(AlmRunMode.RUN_LOCAL);
            builder.SetAlmRunHost("localhost");

            return(builder.GetProperties());
        }
        public override Dictionary <string, string> GetTaskProperties()
        {
            LauncherParamsBuilder builder = new LauncherParamsBuilder();

            builder.SetRunType(RunType.Alm);
            builder.SetAlmServerUrl(ALMServerPath);
            builder.SetSSOEnabled(IsSSO);
            builder.SetClientID(ClientID);
            builder.SetApiKeySecret(ApiKeySecret);
            builder.SetAlmUserName(ALMUserName);
            builder.SetAlmPassword(ALMPassword);
            builder.SetAlmDomain(ALMDomain);
            builder.SetAlmProject(ALMProject);
            builder.SetAlmRunHost(ALMRunHost);
            builder.SetAlmTimeout(TimeOut);
            builder.SetBuildNumber(BuildNumber);

            switch (RunMode)
            {
            case "runLocally":
                builder.SetAlmRunMode(AlmRunMode.RUN_LOCAL);
                break;

            case "runOnPlannedHost":
                builder.SetAlmRunMode(AlmRunMode.RUN_PLANNED_HOST);
                break;

            case "runRemotely":
                builder.SetAlmRunMode(AlmRunMode.RUN_REMOTE);
                break;
            }

            if (!string.IsNullOrEmpty(ALMTestSet))
            {
                int i = 1;
                foreach (string testSet in ALMTestSet.Split(C.LINE_FEED))
                {
                    builder.SetTestSet(i++, testSet.Replace(@"\", @"\\"));
                }
            }
            else
            {
                builder.SetAlmTestSet("");
            }

            return(builder.GetProperties());
        }
Example #4
0
        public override bool ImportSelectedTests(string importDestinationPath, IEnumerable <Object> selectedTestSets)
        {
            if (selectedTestSets != null && selectedTestSets.Count() > 0)
            {
                ObservableList <QCTestSetTreeItem> testSetsItemsToImport = new ObservableList <QCTestSetTreeItem>();
                foreach (QCTestSetTreeItem testSetItem in selectedTestSets)
                {
                    //check if some of the Test Set was already imported
                    if (testSetItem.AlreadyImported == true)
                    {
                        Amdocs.Ginger.Common.eUserMsgSelection userSelection = Reporter.ToUser(eUserMsgKey.TestSetExists, testSetItem.TestSetName);
                        if (userSelection == Amdocs.Ginger.Common.eUserMsgSelection.Yes)
                        {
                            //Delete the mapped BF
                            File.Delete(testSetItem.MappedBusinessFlow.FileName);
                            testSetsItemsToImport.Add(testSetItem);
                        }
                    }
                    else
                    {
                        testSetsItemsToImport.Add(testSetItem);
                    }
                }

                if (testSetsItemsToImport.Count == 0)
                {
                    return(false); //noting to import
                }
                //Refresh Ginger repository and allow GingerQC to use it
                ALMIntegration.Instance.AlmCore.InitCoreObjs();

                foreach (QCTestSetTreeItem testSetItemtoImport in testSetsItemsToImport)
                {
                    try
                    {
                        //import test set data
                        Reporter.ToStatus(eStatusMsgKey.ALMTestSetImport, null, testSetItemtoImport.TestSetName);
                        ALMTestSet TS = new ALMTestSet();
                        TS.TestSetID   = testSetItemtoImport.TestSetID;
                        TS.TestSetName = testSetItemtoImport.TestSetName;
                        TS.TestSetPath = testSetItemtoImport.Path;
                        TS             = ((QCRestAPICore)ALMIntegration.Instance.AlmCore).ImportTestSetData(TS);

                        //convert test set into BF
                        BusinessFlow tsBusFlow = ((QCRestAPICore)ALMIntegration.Instance.AlmCore).ConvertQCTestSetToBF(TS);

                        if (WorkSpace.Instance.Solution.MainApplication != null)
                        {
                            //add the applications mapped to the Activities
                            foreach (Activity activ in tsBusFlow.Activities)
                            {
                                if (string.IsNullOrEmpty(activ.TargetApplication) == false)
                                {
                                    if (tsBusFlow.TargetApplications.Where(x => x.Name == activ.TargetApplication).FirstOrDefault() == null)
                                    {
                                        ApplicationPlatform appAgent = WorkSpace.Instance.Solution.ApplicationPlatforms.Where(x => x.AppName == activ.TargetApplication).FirstOrDefault();
                                        if (appAgent != null)
                                        {
                                            tsBusFlow.TargetApplications.Add(new TargetApplication()
                                            {
                                                AppName = appAgent.AppName
                                            });
                                        }
                                    }
                                }
                            }
                            //handle non mapped Activities
                            if (tsBusFlow.TargetApplications.Count == 0)
                            {
                                tsBusFlow.TargetApplications.Add(new TargetApplication()
                                {
                                    AppName = WorkSpace.Instance.Solution.MainApplication
                                });
                            }
                            foreach (Activity activ in tsBusFlow.Activities)
                            {
                                if (string.IsNullOrEmpty(activ.TargetApplication))
                                {
                                    activ.TargetApplication = tsBusFlow.MainApplication;
                                }
                            }
                        }
                        else
                        {
                            foreach (Activity activ in tsBusFlow.Activities)
                            {
                                activ.TargetApplication = null; // no app configured on solution level
                            }
                        }

                        AddTestSetFlowToFolder(tsBusFlow, importDestinationPath);

                        Reporter.HideStatusMessage();
                    }
                    catch (Exception ex)
                    {
                        Reporter.ToUser(eUserMsgKey.ErrorInTestsetImport, testSetItemtoImport.TestSetName, ex.Message);
                        Reporter.ToLog(eLogLevel.ERROR, "Error importing from QC", ex);
                    }
                }

                Reporter.ToUser(eUserMsgKey.TestSetsImportedSuccessfully);

                Reporter.ToLog(eLogLevel.DEBUG, "Imported from QC successfully");
                return(true);
            }
            Reporter.ToLog(eLogLevel.ERROR, "Error importing from QC");
            return(false);
        }
Example #5
0
 public ALMTestSet GetALMTestCases(ALMTestSet almTestSet)
 {
     return(AlmRepo.GetALMTestCasesToTestSetObject(almTestSet));
 }
Example #6
0
 public void GetALMTestSetData(ALMTestSet almTestSet)
 {
     AlmRepo.GetALMTestSetData(almTestSet);
 }
Example #7
0
 public virtual ALMTestSet GetALMTestCasesToTestSetObject(ALMTestSet almTestSet)
 {
     throw new NotImplementedException();
 }
Example #8
0
 public virtual void GetALMTestSetData(ALMTestSet almTestSet)
 {
     throw new NotImplementedException();
 }
Example #9
0
 public override ALMTestSet GetALMTestCasesToTestSetObject(ALMTestSet almTestSet)
 {
     return(((ZephyrEntCore)ALMIntegration.Instance.AlmCore).ImportTestSetData(almTestSet));
 }
Example #10
0
        private void SetTestSetsData()
        {
            mQcTestCasesList.Clear();
            mTestCaseDetailsList.Clear();
            mAutomatedPrecentage  = 0;
            mExecutedNumber       = 0;
            mRunsNumber           = 0;
            mPassedRunsPrecentage = 0;
            if (mSelectQcTestSets != null && mSelectQcTestSets.Count > 0)
            {
                foreach (QCTestSetTreeItem testSetItem in mSelectQcTestSets)
                {
                    ALMTestSet TS = new ALMTestSet();
                    TS.TestSetID   = testSetItem.TestSetID;
                    TS.TestSetName = testSetItem.TestSetName;
                    TS.TestSetPath = testSetItem.Path;
                    TS             = ImportFromQC.ImportTestSetData(TS);//get test cases

                    foreach (ALMTSTest tc in TS.Tests)
                    {
                        mQcTestCasesList.Add(tc);
                        int automatedStepsCouter = 0;
                        QCManagerReportTestCaseDetails testCaseDetails = new QCManagerReportTestCaseDetails();
                        testCaseDetails.TestSetID    = TS.TestSetID;
                        testCaseDetails.TestSetName  = TS.TestSetName;
                        testCaseDetails.TestCaseID   = tc.LinkedTestID;
                        testCaseDetails.TestCaseName = tc.TestName;

                        //check if the TC is already exist in repository
                        ActivitiesGroup repoActivsGroup = null;

                        ObservableList <ActivitiesGroup> activitiesGroup = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <ActivitiesGroup>();
                        if (tc.LinkedTestID != null && tc.LinkedTestID != string.Empty)
                        {
                            repoActivsGroup = activitiesGroup.Where(x => x.ExternalID == tc.LinkedTestID).FirstOrDefault();
                        }
                        if (repoActivsGroup == null)
                        {
                            repoActivsGroup = activitiesGroup.Where(x => x.ExternalID == tc.TestID).FirstOrDefault();
                        }
                        if (repoActivsGroup != null)
                        {
                            testCaseDetails.ActivitiesGroupID   = repoActivsGroup.Guid;
                            testCaseDetails.ActivitiesGroupName = repoActivsGroup.Name;
                            //check for automation percentage
                            foreach (ALMTSTestStep step in tc.Steps)
                            {
                                ObservableList <Activity> activities = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Activity>();
                                Activity repoStepActivity            = activities.Where(x => x.ExternalID == step.StepID).FirstOrDefault();
                                if (repoStepActivity != null)
                                {
                                    if (repoStepActivity.AutomationStatus == eActivityAutomationStatus.Automated)
                                    {
                                        automatedStepsCouter++;
                                    }
                                }
                            }
                        }
                        else
                        {
                            testCaseDetails.ActivitiesGroupName = "NA";
                        }
                        //set automation percentage
                        double automatedActsPrecanteg = 0;
                        if (tc.Steps.Count > 0)
                        {
                            automatedActsPrecanteg = ((double)automatedStepsCouter / (double)tc.Steps.Count);
                            mAutomatedPrecentage  += automatedActsPrecanteg;
                            automatedActsPrecanteg = Math.Floor(automatedActsPrecanteg * 100);
                            testCaseDetails.ActivitiesGroupAutomationPrecentage = automatedActsPrecanteg.ToString() + "%";
                        }
                        else
                        {
                            testCaseDetails.ActivitiesGroupAutomationPrecentage = "0%";
                        }

                        //set execution details
                        CalculateTCExecutionDetails(tc, testCaseDetails);

                        mTestCaseDetailsList.Add(testCaseDetails);
                    }
                }
            }

            //get the executers names
            var groups = mQcTestCasesList.SelectMany(x => x.Runs).GroupBy(y => y.Tester)
                         .Select(n => new
            {
                TesterName = n.Key.ToString(),
                Count      = n.Count()
            }
                                 )
                         .OrderBy(n => n.TesterName);

            ExecutionTesterFilterComboBox.SelectionChanged -= ExecutionTesterFilterComboBox_SelectionChanged;
            ExecutionTesterFilterComboBox.SelectedItem      = null;
            ExecutionTesterFilterComboBox.Items.Clear();
            ExecutionTesterFilterComboBox.Items.Add("Any");
            foreach (var v in groups)
            {
                ExecutionTesterFilterComboBox.Items.Add(v.TesterName);
            }
            ExecutionTesterFilterComboBox.SelectedValue     = "Any";
            ExecutionTesterFilterComboBox.SelectionChanged += ExecutionTesterFilterComboBox_SelectionChanged;
        }
Example #11
0
 public BusinessFlow ConvertQCTestSetToBF(ALMTestSet testSet)
 {
     return(ImportFromQC.ConvertQCTestSetToBF(testSet));
 }
Example #12
0
 public ALMTestSet ImportTestSetData(ALMTestSet TS)
 {
     return(ImportFromQC.ImportTestSetData(TS));
 }