Esempio n. 1
0
        public QC.ALMTestSet ImportTestSetData(QC.ALMTestSet testSet)
        {
            List <BaseResponseItem> selectedTcs = GetZephyrEntTcsByTreeId(Convert.ToInt32(testSet.TestSetID));
            var token = (JToken)selectedTcs[0].TryGetItem("results");

            foreach (var testInstance in token)
            {
                testSet.Tests.Add(ImportTSTest(((JToken)testInstance).SelectToken("testcase")));
            }
            return(testSet);
        }
Esempio n. 2
0
 public BusinessFlow ConvertQCTestSetToBF(QC.ALMTestSet tS)
 {
     return(zephyrEntImportManager.ConvertQCTestSetToBF(tS));
 }
Esempio n. 3
0
 public QC.ALMTestSet ImportTestSetData(QC.ALMTestSet testSet)
 {
     return(ImportFromQCRest.ImportTestSetData(testSet));
 }
Esempio n. 4
0
 public BusinessFlow ConvertQCTestSetToBF(QC.ALMTestSet testSet)
 {
     return(ImportFromQCRest.ConvertQCTestSetToBF(testSet));
 }
Esempio n. 5
0
        public override bool ImportSelectedTests(string importDestinationPath, IEnumerable <object> selectedTestSets)
        {
            if (selectedTestSets != null && selectedTestSets.Count() > 0)
            {
                ObservableList <ZephyrEntPhaseTreeItem> testSetsItemsToImport = new ObservableList <ZephyrEntPhaseTreeItem>();
                foreach (ZephyrEntPhaseTreeItem testSetItem in selectedTestSets)
                {
                    //check if some of the Test Set was already imported
                    if (testSetItem.AlreadyImported)
                    {
                        Amdocs.Ginger.Common.eUserMsgSelection userSelection = Reporter.ToUser(eUserMsgKey.TestSetExists, testSetItem.Name);
                        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
                ALMIntegration.Instance.AlmCore.InitCoreObjs();

                foreach (ZephyrEntPhaseTreeItem testSetItemtoImport in testSetsItemsToImport)
                {
                    try
                    {
                        //import test set data
                        Reporter.ToStatus(eStatusMsgKey.ALMTestSetImport, null, testSetItemtoImport.Name);
                        GingerCore.ALM.QC.ALMTestSet TS = new GingerCore.ALM.QC.ALMTestSet();
                        TS.TestSetID   = testSetItemtoImport.Id;
                        TS.TestSetName = testSetItemtoImport.Name;
                        TS.TestSetPath = testSetItemtoImport.Path;
                        TS             = ((ZephyrEntCore)ALMIntegration.Instance.AlmCore).ImportTestSetData(TS);

                        //convert test set into BF
                        BusinessFlow tsBusFlow = ((ZephyrEntCore)ALMIntegration.Instance.AlmCore).ConvertQCTestSetToBF(TS);
                        if (testSetItemtoImport.entityType == EntityFolderType.Cycle)
                        {
                            testSetItemtoImport.FatherId = testSetItemtoImport.TestSetID;
                        }
                        tsBusFlow.ExternalID2 = testSetItemtoImport.FatherId;
                        if (WorkSpace.Instance.Solution.MainApplication != null)
                        {
                            //add the applications mapped to the Activities
                            foreach (Activity activ in tsBusFlow.Activities)
                            {
                                if (!string.IsNullOrEmpty(activ.TargetApplication))
                                {
                                    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.Name, ex.Message);
                        Reporter.ToLog(eLogLevel.ERROR, "Error importing from Zephyr Ent", ex);
                    }
                }

                Reporter.ToUser(eUserMsgKey.TestSetsImportedSuccessfully);

                Reporter.ToLog(eLogLevel.DEBUG, "Imported from Zephyr Ent successfully");
                return(true);
            }
            Reporter.ToLog(eLogLevel.ERROR, "Error importing from Zephyr Ent");
            return(false);
        }