Exemple #1
0
        List <ITreeViewItem> ITreeViewItem.Childrens()
        {
            List <ITreeViewItem> Childrens        = new List <ITreeViewItem>();
            List <string>        strParentFolders = QCConnect.GetTestPlanExplorer(Path);

            //Add QC folders to tree children
            foreach (string sFolder in strParentFolders)
            {
                QCTestPlanFolderTreeItem pfn = new QCTestPlanFolderTreeItem();
                pfn.Folder = sFolder;
                pfn.Path   = Path + @"\" + sFolder;
                Childrens.Add(pfn);
            }

            return(Childrens);
        }
        List <ITreeViewItem> ITreeViewItem.Childrens()
        {
            CurrentChildrens = new List <ITreeViewItem>();

            // get the sub items for the root here and return list of Childrens
            // Step #1 add sub folder of current folder
            List <string> strParentFolders = QCConnect.GetTestLabExplorer(Path);

            //Add QC folders to tree children

            foreach (string sFolder in strParentFolders)
            {
                QCTestLabFolderTreeItem pfn = new QCTestLabFolderTreeItem();
                pfn.Folder = sFolder;
                pfn.Path   = Path + @"\" + sFolder;
                CurrentChildrens.Add(pfn);
            }

            // Step #2 add folder Test Set list
            List <QCTestSetSummary> sTestSets = QCConnect.GetTestSetExplorer(Path);

            foreach (QCTestSetSummary tsItem in sTestSets)
            {
                tsItem.TestSetStatuses = new List <string[]>();
                QCTestSetTreeItem pfn = new QCTestSetTreeItem();
                pfn.TestSetID   = tsItem.TestSetID.ToString();
                pfn.TestSetName = tsItem.TestSetName;
                pfn.Path        = Path + @"\" + tsItem.TestSetName;
                QCTestSetSummary tsItemStatus = QCConnect.GetTSRunStatus(tsItem);
                pfn.TestSetStatuses = tsItem.TestSetStatuses;
                //if (IsAutomated(pfn.TestSetID)) pfn.Automated = true; else pfn.Automated = false;
                //IsTestSetAlreadyImported(pfn);
                pfn.IsTestSetAlreadyImported();
                CurrentChildrens.Add(pfn);
            }

            return(CurrentChildrens);
        }
Exemple #3
0
 public override IEnumerable <Object> GetTestSetExplorer(string path)
 {
     return(QCConnect.GetTestSetExplorer(path));
 }
Exemple #4
0
 public override List <string> GetTestLabExplorer(string path)
 {
     return(QCConnect.GetTestLabExplorer(path));
 }
Exemple #5
0
 public override Object GetTSRunStatus(Object tsItem)
 {
     return(QCConnect.GetTSRunStatus(tsItem));
 }
Exemple #6
0
        public override bool ExportBusinessFlowToALM(BusinessFlow businessFlow, bool performSaveAfterExport = false, ALMIntegration.eALMConnectType almConectStyle = ALMIntegration.eALMConnectType.Silence, 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);
            }

            TestSet matchingTS = null;

            Amdocs.Ginger.Common.eUserMsgSelection userSelec = Amdocs.Ginger.Common.eUserMsgSelection.None;
            //check if the businessFlow already mapped to QC Test Set
            if (String.IsNullOrEmpty(businessFlow.ExternalID) == false)
            {
                matchingTS = ((QCCore)ALMIntegration.Instance.AlmCore).GetQCTestSet(businessFlow.ExternalID);
                if (matchingTS != null)
                {
                    //ask user if want to continue
                    userSelec = Reporter.ToUser(eUserMsgKey.BusinessFlowAlreadyMappedToTC, businessFlow.Name, matchingTS.TestSetFolder.Path + "\\" + matchingTS.Name);
                    if (userSelec == Amdocs.Ginger.Common.eUserMsgSelection.Cancel)
                    {
                        return(false);
                    }
                    else if (userSelec == Amdocs.Ginger.Common.eUserMsgSelection.No)
                    {
                        matchingTS = null;
                    }
                }
            }

            //check if all of the business flow activities groups already exported to QC and export the ones which not
            foreach (ActivitiesGroup ag in businessFlow.ActivitiesGroups)
            {
                //check if the ActivitiesGroup already mapped to QC Test Case
                matchingTC = null;
                if (String.IsNullOrEmpty(ag.ExternalID) == false)
                {
                    matchingTC = ((QCCore)ALMIntegration.Instance.AlmCore).GetQCTest(ag.ExternalID);
                    if (matchingTC != null)
                    {
                        //ask user if want to continue
                        Amdocs.Ginger.Common.eUserMsgSelection userSelect = Reporter.ToUser(eUserMsgKey.ActivitiesGroupAlreadyMappedToTC, ag.Name, matchingTC["TS_SUBJECT"].Path + "\\" + matchingTC.Name);
                        if (userSelect == Amdocs.Ginger.Common.eUserMsgSelection.Cancel)
                        {
                            return(false);
                        }
                        else if (userSelect == Amdocs.Ginger.Common.eUserMsgSelection.No)
                        {
                            matchingTC = null;
                        }
                        else
                        {
                            testPlanUploadPath = matchingTC["TS_SUBJECT"].Path;
                        }
                    }
                }

                //if user selected No and want to create new testplans to selected folder path
                if (matchingTC == null && String.IsNullOrEmpty(testPlanUploadPath))
                {
                    //get the QC Test Plan path to upload the activities group to
                    testPlanUploadPath = SelectALMTestPlanPath();
                    if (String.IsNullOrEmpty(testPlanUploadPath))
                    {
                        //no path to upload to
                        return(false);
                    }

                    //create upload path if checked to create separete folder
                    if (QCTestPlanFolderTreeItem.IsCreateBusinessFlowFolder)
                    {
                        //create folder with BF name
                        try
                        {
                            if (QCConnect.CreateFolder(testPlanUploadPath, businessFlow.Name))
                            {
                                testPlanUploadPath += "\\" + businessFlow.Name;
                            }
                        }
                        catch (Exception ex)
                        {
                            Reporter.ToLog(eLogLevel.ERROR, "Failed to get create folder for Test Plan", ex);
                        }
                    }
                }
                ExportActivitiesGroupToALM(ag, testPlanUploadPath);
            }

            if (matchingTS == null && string.IsNullOrEmpty(testLabUploadPath))
            {
                if (userSelec == Amdocs.Ginger.Common.eUserMsgSelection.No)
                {
                    Reporter.ToUser(eUserMsgKey.ExportQCNewTestSetSelectDiffFolder);
                }

                //get the QC Test Plan path to upload the activities group to
                testLabUploadPath = SelectALMTestLabPath();
                if (String.IsNullOrEmpty(testLabUploadPath))
                {
                    //no path to upload to
                    return(false);
                }
            }

            //upload the business flow
            Reporter.ToStatus(eStatusMsgKey.ExportItemToALM, null, businessFlow.Name);
            string res = string.Empty;
            //TODO : need to update to retrieve only Test Set Item Fields -->DONE
            ObservableList <ExternalItemFieldBase> testSetFields = WorkSpace.Instance.Solution.ExternalItemsFields;

            ALMIntegration.Instance.RefreshALMItemFields(testSetFields, true, null);
            var  filterTestSetFields = testSetFields.Where(tc => tc.ItemType == eQCItemType.TestSet.ToString()).ToList();
            bool exportRes           = ((QCCore)ALMIntegration.Instance.AlmCore).ExportBusinessFlowToALM(businessFlow, matchingTS, testLabUploadPath, new ObservableList <ExternalItemFieldBase> (filterTestSetFields), ref res);

            Reporter.HideStatusMessage();
            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, res);
            }
            //}

            return(false);
        }
Exemple #7
0
 public override bool DisconnectALMProjectStayLoggedIn()
 {
     return(QCConnect.DisconnectQCProjectStayLoggedIn());
 }
Exemple #8
0
 public override List <string> GetALMDomainProjects(string ALMDomain)
 {
     ALMCore.AlmConfig.ALMDomain = ALMDomain;
     return(QCConnect.GetQCDomainProjects(ALMCore.AlmConfig.ALMDomain));
 }
Exemple #9
0
 public override List <string> GetALMDomains()
 {
     return(QCConnect.GetQCDomains());
 }
Exemple #10
0
 public override void DisconnectALMServer()
 {
     QCConnect.DisconnectQCServer();
 }
Exemple #11
0
 public override bool ConnectALMProject()
 {
     return(QCConnect.ConnectQCProject(ALMCore.AlmConfig.ALMServerURL, ALMCore.AlmConfig.ALMUserName, ALMCore.AlmConfig.ALMPassword, ALMCore.AlmConfig.ALMDomain, ALMCore.AlmConfig.ALMProjectName));
 }
Exemple #12
0
 public override bool ConnectALMServer()
 {
     return(QCConnect.ConnectQCServer(ALMCore.AlmConfig.ALMServerURL, ALMCore.AlmConfig.ALMUserName, ALMCore.AlmConfig.ALMPassword));
 }
Exemple #13
0
 public override Dictionary <string, string> GetALMDomainProjects(string ALMDomain)
 {
     ALMCore.DefaultAlmConfig.ALMDomain = ALMDomain;
     return(QCConnect.GetQCDomainProjects(ALMCore.DefaultAlmConfig.ALMDomain));
 }
Exemple #14
0
 public override bool ConnectALMProject()
 {
     ALMCore.DefaultAlmConfig.ALMProjectName = ALMCore.DefaultAlmConfig.ALMProjectKey;
     return(QCConnect.ConnectQCProject(ALMCore.DefaultAlmConfig.ALMServerURL, ALMCore.DefaultAlmConfig.ALMUserName, ALMCore.DefaultAlmConfig.ALMPassword, ALMCore.DefaultAlmConfig.ALMDomain, ALMCore.DefaultAlmConfig.ALMProjectKey));
 }