private void RefreshDomainList(eALMConnectType userMsgStyle)
        {
            List <string> Domains = ALMIntegration.Instance.GetALMDomains(userMsgStyle);

            string currDomain = CurrentAlmConfigurations.ALMDomain;

            DomainComboBox.Items.Clear();
            foreach (string domain in Domains)
            {
                DomainComboBox.Items.Add(domain);
            }

            if (DomainComboBox.Items.Count > 0)
            {
                //sort
                DomainComboBox.Items.SortDescriptions.Add(new System.ComponentModel.SortDescription("", System.ComponentModel.ListSortDirection.Descending));

                if (string.IsNullOrEmpty(currDomain) == false)
                {
                    if (DomainComboBox.Items.Contains(currDomain))
                    {
                        CurrentAlmConfigurations.ALMDomain = currDomain;
                        DomainComboBox.SelectedIndex       = DomainComboBox.Items.IndexOf(CurrentAlmConfigurations.ALMDomain);
                    }
                }
                if (DomainComboBox.SelectedIndex == -1)
                {
                    DomainComboBox.SelectedIndex = 0;
                }
            }
        }
        public ALMConnectionPage(eALMConnectType almConnectStyle, bool isConnWin = false)
        {
            CurrentAlmConfigurations = ALMIntegration.Instance.GetDefaultAlmConfig();
            CurrentAlmConfigurations.PropertyChanged += CurrentAlmConfigurations_PropertyChanged;
            CurrentAlmUserConfigurations              = ALMIntegration.Instance.GetCurrentAlmUserConfig(CurrentAlmConfigurations.AlmType);
            ALMIntegration.Instance.UpdateALMType(CurrentAlmConfigurations.AlmType);

            InitializeComponent();
            this.isConnWin      = isConnWin;
            this.almConectStyle = almConnectStyle;

            Bind();

            if (!WorkSpace.Instance.BetaFeatures.Rally)
            {
                RallyRadioButton.Visibility = Visibility.Hidden;
                if (CurrentAlmConfigurations.AlmType == eALMType.RALLY)
                {
                    CurrentAlmConfigurations.AlmType = eALMType.QC;
                }
            }
            if (almConnectStyle != eALMConnectType.Silence)
            {
                if (GetProjectsDetails())
                {
                    ConnectProjectButton.Content = "Save Project Mapping";
                    ConnectProject();
                }
            }
            StyleRadioButtons();
            SetControls();
            ChangeALMType();
        }
 private void GetProjectsDetails_Clicked(object sender, RoutedEventArgs e)
 {
     almConectStyle = eALMConnectType.Manual;
     GetProjectsDetails();
     isProjectMappingCorrect = false;
     SetControls();
 }
 public override bool ConnectALMServer(eALMConnectType userMsgStyle)
 {
     try
     {
         Reporter.ToLog(eLogLevel.DEBUG, "Connecting to QTest server");
         if (ALMIntegration.Instance.AlmCore.ConnectALMServer())
         {
             return(true);
         }
         else
         {
             Reporter.ToUser(eUserMsgKey.ALMConnectFailureWithCurrSettings, "Bad credentials");
             return(false);
         }
     }
     catch (Exception e)
     {
         if (userMsgStyle == eALMConnectType.Manual)
         {
             Reporter.ToUser(eUserMsgKey.QcConnectFailure, e.Message);
         }
         else if (userMsgStyle == eALMConnectType.Auto)
         {
             Reporter.ToUser(eUserMsgKey.ALMConnectFailureWithCurrSettings, e.Message);
         }
         Reporter.ToLog(eLogLevel.WARN, "Error connecting to QTest server", e);
         return(false);
     }
 }
示例#5
0
        public bool AutoALMProjectConnect(eALMConnectType almConnectStyle = eALMConnectType.Silence, bool showConnWin = true, bool asConnWin = false)
        {
            if (AlmCore == null)//added because when running from CLI the AlmCore is Null on connection
            {
                UpdateALMType(ALMCore.GetDefaultAlmConfig().AlmType);
            }

            int  retryConnect = 0;
            bool isConnected  = false;

            while (!isConnected && retryConnect < 2)
            {
                try { isConnected = ConnectALMProject(); }
                catch (Exception e) { Reporter.ToLog(eLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {e.Message}", e); }
                retryConnect++;
            }
            if (!isConnected && almConnectStyle != eALMConnectType.Silence)
            {
                if (showConnWin)
                {
                    App.MainWindow.Dispatcher.Invoke(() =>
                    {
                        ALMConnectionPage almConnPage = new ALMConnectionPage(almConnectStyle, asConnWin);
                        almConnPage.ShowAsWindow();
                    });
                    try { isConnected = ConnectALMProject(); }
                    catch (Exception e) { Reporter.ToLog(eLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {e.Message}", e); }
                }
            }

            return(isConnected);
        }
        public override bool ConnectALMServer(eALMConnectType almConnectType)
        {
            try
            {
                if (almConnectType == eALMConnectType.SettingsPage || almConnectType == eALMConnectType.Manual)
                {
                    HandleSSO();
                }

                Reporter.ToLog(eLogLevel.DEBUG, "Connecting to Octane server");
                if (ALMIntegration.Instance.AlmCore.ConnectALMServer())
                {
                    return(true);
                }
                else
                {
                    Reporter.ToUser(eUserMsgKey.ALMConnectFailureWithCurrSettings, "Bad credentials");
                    return(false);
                }
            }
            catch (Exception e)
            {
                if (almConnectType == eALMConnectType.Manual)
                {
                    Reporter.ToUser(eUserMsgKey.QcConnectFailure, e.Message); //TODO: Fix message
                }
                else if (almConnectType == eALMConnectType.Auto)
                {
                    Reporter.ToUser(eUserMsgKey.ALMConnectFailureWithCurrSettings, e.Message);
                }
                Reporter.ToLog(eLogLevel.WARN, "Error connecting to Octane server", e);
                return(false);
            }
        }
示例#7
0
        public bool TestALMProjectConn(eALMConnectType almConectStyle)
        {
            Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;

            bool connResult = false;

            try
            {
                connResult = AlmCore.ConnectALMProject();
            }
            catch (Exception e)
            {
                Reporter.ToLog(eLogLevel.ERROR, "Error connecting to ALM project", e);
                if (almConectStyle == eALMConnectType.Manual)
                {
                    Reporter.ToUser(eUserMsgKey.ALMLoginFailed, e.Message);
                }
                else if (almConectStyle == eALMConnectType.Auto)
                {
                    Reporter.ToUser(eUserMsgKey.ALMConnectFailureWithCurrSettings, e.Message);
                }
            }

            if (connResult)
            {
                DisconnectALMServer(almConectStyle);
            }

            Mouse.OverrideCursor = null;
            return(connResult);
        }
示例#8
0
        public override bool ConnectALMServer(eALMConnectType userMsgStyle)
        {
            bool isConnectSucc = false;

            Reporter.ToLog(eLogLevel.DEBUG, "Connecting to RQM server");
            try
            {
                isConnectSucc = ALMIntegration.Instance.AlmCore.ConnectALMServer();
            }
            catch (Exception e)
            {
                Reporter.ToLog(eLogLevel.ERROR, "Error connecting to RQM server", e);
            }

            if (!isConnectSucc)
            {
                Reporter.ToLog(eLogLevel.WARN, "Could not connect to RQM server");
                if (userMsgStyle == eALMConnectType.Manual)
                {
                    Reporter.ToUser(eUserMsgKey.ALMConnectFailure);
                }
                else if (userMsgStyle == eALMConnectType.Auto)
                {
                    Reporter.ToUser(eUserMsgKey.ALMConnectFailureWithCurrSettings);
                }
            }

            return(isConnectSucc);
        }
示例#9
0
        public Dictionary <string, string> GetALMDomainProjects(string ALMDomain, eALMConnectType almConectStyle)
        {
            Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;
            Dictionary <string, string> projectsList = new Dictionary <string, string>();

            if (AutoALMServerConnect(almConectStyle))
            {
                projectsList = AlmCore.GetALMDomainProjects(ALMDomain);
                DisconnectALMServer(almConectStyle);
            }
            Mouse.OverrideCursor = null;
            return(projectsList);
        }
示例#10
0
        public List <string> GetALMDomains(eALMConnectType almConectStyle)
        {
            Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;
            List <string> domainList = new List <string>();

            if (AutoALMServerConnect(almConectStyle))
            {
                domainList = AlmCore.GetALMDomains();
                DisconnectALMServer(almConectStyle);
            }

            Mouse.OverrideCursor = null;
            return(domainList);
        }
示例#11
0
        public bool TestALMServerConn(eALMConnectType almConectStyle)
        {
            Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;

            bool connResult = false;

            connResult = AlmRepo.ConnectALMServer(almConectStyle);
            if (connResult)
            {
                DisconnectALMServer(almConectStyle);
            }

            Mouse.OverrideCursor = null;
            return(connResult);
        }
示例#12
0
 public void DisconnectALMServer(eALMConnectType almConectStyle = eALMConnectType.Silence)
 {
     try
     {
         AlmCore.DisconnectALMServer();
     }
     catch (Exception e)
     {
         Reporter.ToLog(eLogLevel.ERROR, "Error disconnecting from ALM", e);
         if (almConectStyle == eALMConnectType.Manual)
         {
             Reporter.ToUser(eUserMsgKey.ALMOperationFailed, "disconnect server", e.Message);
         }
     }
 }
示例#13
0
        public bool AutoALMProjectConnect(eALMConnectType almConnectStyle = eALMConnectType.Silence, bool showConnWin = true, bool asConnWin = false)
        {
            int  retryConnect = 0;
            bool isConnected  = false;

            while (!isConnected && retryConnect < 2)
            {
                try { isConnected = ConnectALMProject(); }
                catch (Exception e) { Reporter.ToLog(eLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {e.Message}", e); }
                retryConnect++;
            }
            if (!isConnected && almConnectStyle != eALMConnectType.Silence)
            {
                if (showConnWin)
                {
                    ALMConnectionPage almConnPage = new ALMConnectionPage(almConnectStyle, asConnWin);
                    almConnPage.ShowAsWindow();
                    try { isConnected = ConnectALMProject(); }
                    catch (Exception e) { Reporter.ToLog(eLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {e.Message}", e); }
                }
            }

            return(isConnected);
        }
示例#14
0
        public override bool ExportBusinessFlowToALM(BusinessFlow businessFlow, bool performSaveAfterExport = false, eALMConnectType almConectStyle = eALMConnectType.Manual, string testPlanUploadPath = null, string testLabUploadPath = null)
        {
            if (businessFlow == null)
            {
                return(false);
            }
            if (WorkSpace.Instance.Solution.ExternalItemsFields.Where(x => x.ItemType == "TestCase").ToList().Count == 0)
            {
                Reporter.ToUser(eUserMsgKey.StaticInfoMessage, "Current solution have no predefined values for RQM's mandatory fields. Please configure before doing export. ('ALM'-'ALM Items Fields Configuration')");
                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 = false;
            string res       = string.Empty;

            Reporter.ToStatus(eStatusMsgKey.ExportItemToALM, null, businessFlow.Name);

            exportRes = ((RQMCore)ALMIntegration.Instance.AlmCore).ExportBusinessFlowToRQM(businessFlow, WorkSpace.Instance.Solution.ExternalItemsFields, ref res);

            if (exportRes)
            {
                if (performSaveAfterExport)
                {
                    Reporter.ToStatus(eStatusMsgKey.SaveItem, null, businessFlow.Name, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow));
                    WorkSpace.Instance.SolutionRepository.SaveRepositoryItem(businessFlow);
                }
                if (almConectStyle != eALMConnectType.Auto && almConectStyle != eALMConnectType.Silence)
                {
                    Reporter.ToUser(eUserMsgKey.ExportItemToALMSucceed);
                }
            }
            else
            {
                Reporter.ToUser(eUserMsgKey.ExportItemToALMFailed, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), businessFlow.Name, res);
            }

            Reporter.HideStatusMessage();
            return(exportRes);
        }
示例#15
0
        public override bool ExportBusinessFlowToALM(BusinessFlow businessFlow, bool performSaveAfterExport = false, eALMConnectType almConectStyle = eALMConnectType.Manual, string testPlanUploadPath = null, string testLabUploadPath = null)
        {
            tcsRepositoryList = new List <TestCaseResource>();
            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);
            }

            List <BaseResponseItem> matchingTS = null;

            Amdocs.Ginger.Common.eUserMsgSelection userSelec = Amdocs.Ginger.Common.eUserMsgSelection.None;
            //check if the businessFlow already mapped to Zephyr ent. Test Set
            if (!String.IsNullOrEmpty(businessFlow.ExternalID))
            {
                matchingTS = ((ZephyrEntCore)ALMIntegration.Instance.AlmCore).GetZephyrEntPhaseById(Convert.ToInt32(businessFlow.ExternalID2));
                if (matchingTS != null && matchingTS.Count > 0)
                {
                    //ask user if want to continute
                    userSelec = Reporter.ToUser(eUserMsgKey.BusinessFlowAlreadyMappedToTC, businessFlow.Name, matchingTS[0].TryGetItem("name").ToString());
                    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 zephyr and export the ones which not
            foreach (ActivitiesGroup ag in businessFlow.ActivitiesGroups)
            {
                matchingTC = null;
                //check if the ActivitiesGroup already mapped to zephyr Test Case
                if (!String.IsNullOrEmpty(ag.ExternalID))
                {
                    matchingTC = ((ZephyrEntCore)ALMIntegration.Instance.AlmCore).GetZephyrEntTest(ag.ExternalID2);
                    if (matchingTC != null && matchingTC.Count > 0)
                    {
                        //ask user if want to continue
                        Amdocs.Ginger.Common.eUserMsgSelection userSelect = Reporter.ToUser(eUserMsgKey.ActivitiesGroupAlreadyMappedToTC, ag.Name, matchingTC[0].TryGetItem("name").ToString());
                        if (userSelect == Amdocs.Ginger.Common.eUserMsgSelection.Cancel)
                        {
                            return(false);
                        }
                        else if (userSelect == Amdocs.Ginger.Common.eUserMsgSelection.No)
                        {
                            matchingTC = null;
                        }
                        else
                        {
                            if (String.IsNullOrEmpty(testPlanUploadPath))
                            {
                                testPlanUploadPath = ((ZephyrEntCore)ALMIntegration.Instance.AlmCore).GetRepositoryTreeIdByTestcaseId(Convert.ToInt32(ag.ExternalID)).ToString();
                            }
                        }
                    }
                }

                //if user selected No and want to create new testplans to selected folder path
                if (matchingTC == null && String.IsNullOrEmpty(testPlanUploadPath))
                {
                    //get the zephyr Test repository 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 (TestRepositoryFolderTreeItem.IsCreateBusinessFlowFolder)
                    {
                        try
                        {
                            TreeNode treeNode = ((ZephyrEntCore)ALMIntegration.Instance.AlmCore).CreateTreeNode();
                            testPlanUploadPath = treeNode.id.ToString();
                        }
                        catch (Exception ex)
                        {
                            Reporter.ToLog(eLogLevel.DEBUG, "Failed to get create folder for Test Repository with Zephyr Ent.", ex);
                        }
                    }
                }

                ExportActivitiesGroupToALM(ag, testPlanUploadPath, false, businessFlow);
            }

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

                //get the zephyr Test Planning path to upload the activities group to
                string uploadData = SelectALMTestLabPath();
                if (String.IsNullOrEmpty(uploadData))
                {
                    //no path to upload to
                    return(false);
                }
                string[] getTypeAndId = uploadData.Split('#');
                testLabUploadPath = getTypeAndId[1];
                bfEntityType      = getTypeAndId[0];
                moduleParentId    = getTypeAndId[2] == null ? string.Empty : getTypeAndId[2];
                folderCycleId     = getTypeAndId[3];
            }

            //upload the business flow
            Reporter.ToStatus(eStatusMsgKey.ExportItemToALM, null, businessFlow.Name);
            string res = string.Empty;

            ObservableList <ExternalItemFieldBase> allFields = new ObservableList <ExternalItemFieldBase>(WorkSpace.Instance.Solution.ExternalItemsFields);

            ALMIntegration.Instance.RefreshALMItemFields(allFields, true, null);

            Dictionary <string, string> testSetFieldsFields = CleanUnrelvantFields(allFields, EntityName.cycle);
            Dictionary <string, string> testInstanceFields  = CleanUnrelvantFields(allFields, EntityName.testcase);

            bool exportRes = ExportBusinessFlowToTestPlanning(businessFlow, matchingTS, testLabUploadPath, testSetFieldsFields, testInstanceFields, 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 != eALMConnectType.Auto)
                {
                    Reporter.ToUser(eUserMsgKey.ExportItemToALMSucceed);
                }
                return(true);
            }
            else
            {
                if (almConectStyle != eALMConnectType.Auto)
                {
                    Reporter.ToUser(eUserMsgKey.ExportItemToALMFailed, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), businessFlow.Name, res);
                }
            }

            return(exportRes);
        }
 public bool ExportVirtualBusinessFlowToALM(BusinessFlow businessFlow, PublishToALMConfig publishToALMConfig, bool performSaveAfterExport = false, eALMConnectType almConnectStyle = eALMConnectType.Silence, string testPlanUploadPath = null, string testLabUploadPath = null)
 {
     return(ALMIntegration.Instance.ExportVirtualBusinessFlowToALM(businessFlow, publishToALMConfig, performSaveAfterExport, almConnectStyle, testPlanUploadPath, testLabUploadPath));
 }
示例#17
0
        public override bool ExportBusinessFlowToALM(BusinessFlow businessFlow, bool performSaveAfterExport = false, eALMConnectType almConectStyle = 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 != eALMConnectType.Auto)
                {
                    Reporter.ToUser(eUserMsgKey.ExportItemToALMSucceed);
                }
                return(true);
            }
            else if (almConectStyle != eALMConnectType.Auto)
            {
                Reporter.ToUser(eUserMsgKey.ExportItemToALMFailed, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), businessFlow.Name, res);
            }
            return(false);
        }
        public override bool ExportBusinessFlowToALM(BusinessFlow businessFlow, bool performSaveAfterExport = false, eALMConnectType almConectStyle = eALMConnectType.Manual, string testPlanUploadPath = null, string testLabUploadPath = null)
        {
            if (businessFlow == null)
            {
                return(false);
            }

            if (businessFlow.ActivitiesGroups.Count == 0 && almConectStyle != eALMConnectType.Silence)
            {
                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);
            }

            ALMTestSetData matchingTS = null;

            eUserMsgSelection userSelec;

            //TO DO MaheshK : check if the businessFlow already mapped to Octane Test Suite
            if (!String.IsNullOrEmpty(businessFlow.ExternalID))
            {
                matchingTS = ((OctaneCore)ALMIntegration.Instance.AlmCore).GetTestSuiteById(businessFlow.ExternalID);
                if (matchingTS != null)
                {
                    //ask user if want to continute
                    userSelec = Reporter.ToUser(eUserMsgKey.BusinessFlowAlreadyMappedToTC, businessFlow.Name, matchingTS.Name);
                    if (userSelec == eUserMsgSelection.Cancel)
                    {
                        return(false);
                    }
                    else if (userSelec == eUserMsgSelection.No)
                    {
                        matchingTS = null;
                    }
                    else
                    {
                        if (String.IsNullOrEmpty(testPlanUploadPath))
                        {
                            testPlanUploadPath = matchingTS.ParentId;
                        }
                    }
                }
            }


            bool performSave = false;

            //just to check if new TC needs to be created or update has to be done
            if (matchingTS == null)
            {
                if (almConectStyle != eALMConnectType.Silence)
                {
                    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)
                {
                    try
                    {
                        string folderId = octaneCore.GetLastTestPlanIdFromPath(testPlanUploadPath).ToString();
                        folderId           = octaneCore.CreateApplicationModule(businessFlow.Name, businessFlow.Description, folderId);
                        testPlanUploadPath = folderId;
                    }
                    catch (Exception ex)
                    {
                        Reporter.ToLog(eLogLevel.ERROR, "Failed to get create folder for Test Plan with Octane REST API", ex);
                    }
                }
                else
                {
                    testPlanUploadPath = octaneCore.GetLastTestPlanIdFromPath(testPlanUploadPath).ToString();
                }
            }
            else
            {
                matchingTC = new ALMTestCase();
            }
            //check if all of the business flow activities groups already exported to Octane and export the ones which not
            foreach (ActivitiesGroup ag in businessFlow.ActivitiesGroups)
            {
                ExportActivitiesGroupToALM(ag, testPlanUploadPath, performSave, businessFlow);
            }
            testLabUploadPath = testPlanUploadPath;

            //upload the business flow
            Reporter.ToStatus(eStatusMsgKey.ExportItemToALM, null, businessFlow.Name);
            string res = string.Empty;

            ObservableList <ExternalItemFieldBase> allFields = new ObservableList <ExternalItemFieldBase>(WorkSpace.Instance.Solution.ExternalItemsFields);

            ALMIntegration.Instance.RefreshALMItemFields(allFields, true, null);

            ObservableList <ExternalItemFieldBase> testSetFieldsFields = CleanUnrelvantFields(allFields, "Test Suite");

            bool exportRes = ((OctaneCore)ALMIntegration.Instance.AlmCore).ExportBusinessFlow(businessFlow, matchingTS, testLabUploadPath, testSetFieldsFields, null, 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 != eALMConnectType.Auto && almConectStyle != eALMConnectType.Silence)
                {
                    Reporter.ToUser(eUserMsgKey.ExportItemToALMSucceed);
                }
                return(true);
            }
            else
            if (almConectStyle != eALMConnectType.Auto && almConectStyle != eALMConnectType.Silence)
            {
                Reporter.ToUser(eUserMsgKey.ExportItemToALMFailed, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), businessFlow.Name, res);
            }

            return(false);
        }
示例#19
0
        public override bool ExportBusinessFlowToALM(BusinessFlow businessFlow, bool performSaveAfterExport = false, eALMConnectType almConectStyle = eALMConnectType.Silence, string parentObjectId = null, string testCaseParentObjectId = 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);
            }

            QtestTestSuite matchingTS = null;

            eUserMsgSelection userSelec = eUserMsgSelection.None;

            //check if the businessFlow already mapped to QC Test Set
            if (!String.IsNullOrEmpty(businessFlow.ExternalID))
            {
                matchingTS = ((QtestCore)ALMIntegration.Instance.AlmCore).GetQtestTestSuite(businessFlow.ExternalID);
                if (matchingTS != null)
                {
                    //ask user if want to continue
                    userSelec = Reporter.ToUser(eUserMsgKey.BusinessFlowAlreadyMappedToTC, businessFlow.Name, matchingTS.Name);
                    if (userSelec == eUserMsgSelection.Cancel)
                    {
                        return(false);
                    }
                    else if (userSelec == 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 Qtest Test Case
                matchingTC = null;
                if (!String.IsNullOrEmpty(ag.ExternalID))
                {
                    matchingTC = ((QtestCore)ALMIntegration.Instance.AlmCore).GetQtestTest((long)Convert.ToInt32(ag.ExternalID));
                    if (matchingTC != null)
                    {
                        //ask user if want to continue
                        eUserMsgSelection userSelect = Reporter.ToUser(eUserMsgKey.ActivitiesGroupAlreadyMappedToTC, ag.Name, matchingTC.TestName);
                        if (userSelect == eUserMsgSelection.Cancel)
                        {
                            return(false);
                        }
                        else if (userSelect == eUserMsgSelection.No)
                        {
                            matchingTC = null;
                        }
                        else
                        {
                            parentObjectId = matchingTC.TestID;
                        }
                    }
                }

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

            if (matchingTS == null && string.IsNullOrEmpty(parentObjectId))
            {
                if (userSelec == eUserMsgSelection.No)
                {
                    Reporter.ToUser(eUserMsgKey.ExportQCNewTestSetSelectDiffFolder);
                }
                parentObjectId = SelectALMTestLabPath();
                if (String.IsNullOrEmpty(parentObjectId))
                {
                    //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);    // Arvind to merge it from here
            var  filterTestSetFields = testSetFields.Where(tc => tc.ItemType == eQCItemType.TestSet.ToString()).ToList();
            bool exportRes           = ((QtestCore)ALMIntegration.Instance.AlmCore).ExportBusinessFlowToALM(businessFlow, matchingTS, parentObjectId, 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 != eALMConnectType.Auto)
                {
                    Reporter.ToUser(eUserMsgKey.ExportItemToALMSucceed);
                }
                return(true);
            }
            else
            {
                if (almConectStyle != eALMConnectType.Auto)
                {
                    Reporter.ToUser(eUserMsgKey.ExportItemToALMFailed, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), businessFlow.Name, res);
                }
            }

            return(false);
        }
示例#20
0
 public abstract bool ConnectALMServer(eALMConnectType userMsgStyle);
示例#21
0
        public override bool ExportBusinessFlowToALM(BusinessFlow businessFlow, bool performSaveAfterExport = false, eALMConnectType almConectStyle = 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);
            }

            QCRestClient.QCTestSet 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 = ((QCRestAPICore)ALMIntegration.Instance.AlmCore).GetQCTestSet(businessFlow.ExternalID);
                if (matchingTS != null)
                {
                    //ask user if want to continute
                    userSelec = Reporter.ToUser(eUserMsgKey.BusinessFlowAlreadyMappedToTC, businessFlow.Name, 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)
            {
                //
                matchingTC = null;
                //check if the ActivitiesGroup already mapped to QC Test Case
                if (String.IsNullOrEmpty(ag.ExternalID) == false)
                {
                    matchingTC = ((QCRestAPICore)ALMIntegration.Instance.AlmCore).GetQCTest(ag.ExternalID);
                    if (matchingTC != null)
                    {
                        //ask user if want to continute
                        Amdocs.Ginger.Common.eUserMsgSelection userSelect = Reporter.ToUser(eUserMsgKey.ActivitiesGroupAlreadyMappedToTC, ag.Name, matchingTC.Name);
                        if (userSelect == Amdocs.Ginger.Common.eUserMsgSelection.Cancel)
                        {
                            return(false);
                        }
                        else if (userSelect == Amdocs.Ginger.Common.eUserMsgSelection.No)
                        {
                            matchingTC = null;
                        }
                        else
                        {
                            if (String.IsNullOrEmpty(testPlanUploadPath))
                            {
                                //testPlanUploadPath = "";
                                string parentId = matchingTC.ElementsField["parent-id"].ToString();

                                //need to test as the function changed in the library
                                QCTestFolder testPlanFolder = QCRestAPIConnect.QcRestClient.GetTestPlanFolderDetails(parentId);
                                string       revrsePath     = testPlanFolder.Name + "/";

                                string testPlanRootFolderId = QCRestAPIConnect.QcRestClient.GetTestPlanRootFolder().Id;
                                while (testPlanFolder.Id != testPlanRootFolderId)
                                {
                                    testPlanFolder = QCRestAPIConnect.QcRestClient.GetTestPlanFolderDetails(testPlanFolder.ParentId);
                                    revrsePath     = revrsePath + testPlanFolder.Name + "/";
                                }
                                revrsePath = revrsePath.Substring(0, revrsePath.Length - 1);
                                string[] str = revrsePath.Split('/');
                                Array.Reverse(str);
                                testPlanUploadPath = string.Join("\\", str);
                            }
                        }
                    }
                }

                //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)
                    {
                        try
                        {
                            string newFolderId = QCRestAPIConnect.GetLastTestPlanIdFromPath(testPlanUploadPath).ToString();
                            QCItem newFolder   = new QCItem();
                            newFolder.Fields.Add("name", businessFlow.Name);
                            newFolder.Fields.Add("parent-id", QCRestAPIConnect.GetLastTestPlanIdFromPath(testPlanUploadPath).ToString());
                            ALMResponseData responseData = QCRestAPIConnect.CreateNewEntity(ResourceType.TEST_FOLDERS, newFolder);
                            newFolderId        = responseData.IdCreated;
                            testPlanUploadPath = testPlanUploadPath + "\\" + businessFlow.Name;
                        }
                        catch (Exception ex)
                        {
                            Reporter.ToLog(eLogLevel.ERROR, "Failed to get create folder for Test Plan with REST API", ex);
                        }
                    }
                }

                ExportActivitiesGroupToALM(ag, testPlanUploadPath, false, businessFlow);
            }

            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;

            ObservableList <ExternalItemFieldBase> allFields = new ObservableList <ExternalItemFieldBase>(WorkSpace.Instance.Solution.ExternalItemsFields);

            ALMIntegration.Instance.RefreshALMItemFields(allFields, true, null);

            ObservableList <ExternalItemFieldBase> testSetFieldsFields = CleanUnrelvantFields(allFields, ResourceType.TEST_SET);
            ObservableList <ExternalItemFieldBase> testInstanceFields  = CleanUnrelvantFields(allFields, ResourceType.TEST_CYCLE);

            bool exportRes = ((QCRestAPICore)ALMIntegration.Instance.AlmCore).ExportBusinessFlowToALM(businessFlow, matchingTS, testLabUploadPath, testSetFieldsFields, testInstanceFields, 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 != eALMConnectType.Auto)
                {
                    Reporter.ToUser(eUserMsgKey.ExportItemToALMSucceed);
                }
                return(true);
            }
            else if (almConectStyle != eALMConnectType.Auto)
            {
                Reporter.ToUser(eUserMsgKey.ExportItemToALMFailed, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), businessFlow.Name, res);
            }
            return(false);
        }
示例#22
0
        public bool ExportVirtualBusinessFlowToALM(BusinessFlow businessFlow, PublishToALMConfig publishToALMConfig, bool performSaveAfterExport = false, eALMConnectType almConnectStyle = eALMConnectType.Silence, string testPlanUploadPath = null, string testLabUploadPath = null)
        {
            bool isExportSucc = false;
            ObservableList <ExternalItemFieldBase> solutionAlmFields = null;

            try
            {
                solutionAlmFields = SetALMTypeAndFieldsFromSolutionToOperation(publishToALMConfig, solutionAlmFields);
                Reporter.ToLog(eLogLevel.INFO, ("Exporting virtual " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + ": " + businessFlow.Name + " to ALM"));
                if (AutoALMProjectConnect(eALMConnectType.Silence, false))
                {
                    isExportSucc = AlmRepo.ExportBusinessFlowToALM(businessFlow, performSaveAfterExport, almConnectStyle, testPlanUploadPath, testLabUploadPath);
                    DisconnectALMServer();
                }
                return(isExportSucc);
            }
            catch (Exception ex)
            {
                return(isExportSucc);
            }
            finally
            {
                ResetALMTypeAndFieldsFromOperationToSolution(publishToALMConfig, solutionAlmFields);
            }
        }
示例#23
0
 public abstract bool ExportBusinessFlowToALM(BusinessFlow businessFlow, bool performSaveAfterExport = false, eALMConnectType almConectStyle = eALMConnectType.Manual, string testPlanUploadPath = null, string testLabUploadPath = null);
示例#24
0
 public bool ExportVirtualBusinessFlowToALM(BusinessFlow businessFlow, PublishToALMConfig publishToALMConfig, bool performSaveAfterExport = false, eALMConnectType almConnectStyle = eALMConnectType.Silence, string testPlanUploadPath = null, string testLabUploadPath = null)
 {
     return(false);
 }
示例#25
0
        public bool ExportBusinessFlowsResultToALM(ObservableList <BusinessFlow> BusinessFlows, ref string result, PublishToALMConfig publishToALMConfig, eALMConnectType almConnectionType, bool exectutedFromAutomateTab = false)
        {
            ALMCore.SolutionFolder = WorkSpace.Instance.Solution.Folder.ToUpper();
            bool isExportSucc = false;

            if (AutoALMProjectConnect(almConnectionType, false))
            {
                try
                {
                    foreach (BusinessFlow BizFlow in BusinessFlows) //Here going for each businessFlow
                    {
                        try
                        {
                            if (BizFlow.ExternalID != "0" && !String.IsNullOrEmpty(BizFlow.ExternalID))
                            {
                                Reporter.ToLog(eLogLevel.DEBUG, "Executing RunSet Action Publish to ALM for " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " " + BizFlow.Name);
                                Reporter.ToStatus(eStatusMsgKey.ExportExecutionDetails, null, BizFlow.Name, "ALM");

                                if (publishToALMConfig.ToAttachActivitiesGroupReport)
                                {
                                    Ginger.Reports.GingerExecutionReport.ExtensionMethods.CreateActivitiesGroupReportsOfBusinessFlow(null, BizFlow);//need to find a way to specify the releveant environment
                                }

                                isExportSucc = AlmCore.ExportExecutionDetailsToALM(BizFlow, ref result, exectutedFromAutomateTab, publishToALMConfig);
                                if (isExportSucc)
                                {
                                    BizFlow.PublishStatus = BusinessFlow.ePublishStatus.Published;
                                }
                                else
                                {
                                    if ((result == null) || (result == string.Empty))
                                    {
                                        result = GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " - " + BizFlow.Name + " - Error when uploading to ALM." + Environment.NewLine;
                                    }
                                    BizFlow.PublishStatus = BusinessFlow.ePublishStatus.PublishFailed;
                                }
                                Reporter.HideStatusMessage();
                            }
                            else
                            {
                                BizFlow.PublishStatus = BusinessFlow.ePublishStatus.NotPublished;
                                result += GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " - " + BizFlow.Name + " - doesn't have ExternalID, cannot execute publish to ALM RunSet Action" + Environment.NewLine;
                                Reporter.ToLog(eLogLevel.WARN, BizFlow.Name + " - doesn't have ExternalID, cannot execute publish to ALM RunSet Action");
                            }
                        }
                        catch (Exception ex)
                        {
                            result = ex.Message.ToString();
                            BizFlow.PublishStatus = BusinessFlow.ePublishStatus.NotPublished;
                            Reporter.ToLog(eLogLevel.ERROR, BizFlow.Name + " - Export results to ALM failed due to exception", ex);
                        }
                    }

                    return(isExportSucc);
                }
                finally
                {
                    DisconnectALMServer();
                }
            }
            else
            {
                if (exectutedFromAutomateTab)
                {
                    result += "Execution results were not published, Failed to connect to ALM";
                    Reporter.ToLog(eLogLevel.WARN, "Execution results were not published, Failed to connect to ALM");
                }
                else
                {
                    foreach (BusinessFlow BizFlow in BusinessFlows)
                    {
                        BizFlow.PublishStatus = BusinessFlow.ePublishStatus.NotPublished;
                    }
                    result += "Didn't execute " + GingerDicser.GetTermResValue(eTermResKey.RunSet) + " action 'Publish to ALM', Failed to connect to ALM";
                    Reporter.ToLog(eLogLevel.WARN, "Didn't execute " + GingerDicser.GetTermResValue(eTermResKey.RunSet) + " action Publish to ALM, Failed to connect to ALM");
                }
                return(false);
            }
        }
示例#26
0
        //Export Group of Business flows
        public bool ExportAllBusinessFlowsToALM(ObservableList <BusinessFlow> bfToExport, bool performSaveAfterExport = false, eALMConnectType almConectStyle = eALMConnectType.Manual)
        {
            Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;
            //Passing Solution Folder path to GingerCore
            ALMCore.SolutionFolder = WorkSpace.Instance.Solution.Folder.ToUpper();

            bool isExportSucc = true;

            if (AutoALMProjectConnect(eALMConnectType.Auto))
            {
                string testPlanUploadPath = AlmRepo.SelectALMTestPlanPath();
                if (testPlanUploadPath == null)
                {
                    return(false);
                }
                string testLabUploadPath = AlmRepo.SelectALMTestLabPath();
                if (testLabUploadPath == null)
                {
                    return(false);
                }
                foreach (BusinessFlow bf in bfToExport)
                {
                    if (!AlmRepo.ExportBusinessFlowToALM(bf, performSaveAfterExport, almConectStyle, testPlanUploadPath, testLabUploadPath))
                    {
                        isExportSucc = false;
                    }
                }
                DisconnectALMServer();
            }
            else
            {
                isExportSucc = false;
            }

            Mouse.OverrideCursor = null;
            return(isExportSucc);
        }
示例#27
0
        public bool ExportBusinessFlowsResultToALM(ObservableList <BusinessFlow> BusinessFlows, ref string result, PublishToALMConfig publishToALMConfig, eALMConnectType almConnectionType, bool exectutedFromAutomateTab = false)
        {
            ObservableList <ExternalItemFieldBase> solutionAlmFields = null;

            try
            {
                solutionAlmFields      = SetALMTypeAndFieldsFromSolutionToOperation(publishToALMConfig, solutionAlmFields);
                ALMCore.SolutionFolder = WorkSpace.Instance.Solution.Folder.ToUpper();
                if (AutoALMProjectConnect(almConnectionType, false))
                {
                    return(AlmCore.ExportBusinessFlowsResultToALM(BusinessFlows, ref result, publishToALMConfig, almConnectionType, exectutedFromAutomateTab));
                }
                else
                {
                    if (exectutedFromAutomateTab)
                    {
                        result += "Execution results were not published, Failed to connect to ALM";
                        Reporter.ToLog(eLogLevel.WARN, "Execution results were not published, Failed to connect to ALM");
                    }
                    else
                    {
                        foreach (BusinessFlow BizFlow in BusinessFlows)
                        {
                            BizFlow.PublishStatus = BusinessFlow.ePublishStatus.NotPublished;
                        }
                        result += "Didn't execute " + GingerDicser.GetTermResValue(eTermResKey.RunSet) + " action 'Publish to ALM', Failed to connect to ALM";
                        Reporter.ToLog(eLogLevel.WARN, "Didn't execute " + GingerDicser.GetTermResValue(eTermResKey.RunSet) + " action Publish to ALM, Failed to connect to ALM");
                    }
                    return(false);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
            finally
            {
                ResetALMTypeAndFieldsFromOperationToSolution(publishToALMConfig, solutionAlmFields);
            }
        }
示例#28
0
 private bool AutoALMServerConnect(eALMConnectType almConnectStyle)
 {
     return(AlmRepo.ConnectALMServer(almConnectStyle));
 }
示例#29
0
        public override bool ExportBusinessFlowToALM(BusinessFlow businessFlow, bool performSaveAfterExport = false, eALMConnectType almConectStyle = 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));
                    Reporter.ToStatus(eStatusMsgKey.ExportItemToALM, null, businessFlow.Name);
                    bool exportRes = false;
                    switch (ALMCore.DefaultAlmConfig.JiraTestingALM)
                    {
                    case eTestingALMType.Xray:
                        exportRes = ((JiraCore)this.AlmCore).ExportBfToAlm(businessFlow, testCaseFields, testSetFields, testExecutionFields, ref responseStr);
                        break;

                    case eTestingALMType.Zephyr:
                        JiraZephyrTreeItem zephyrExportPath = SelectZephyrExportPath();
                        if (zephyrExportPath == null)
                        {
                            return(true);
                        }
                        if (zephyrExportPath is JiraZephyrVersionTreeItem)
                        {
                            exportRes = ((JiraCore)this.AlmCore).ExportBfToZephyr(businessFlow, testCaseFields, testSetFields,
                                                                                  testExecutionFields, ref responseStr,
                                                                                  ((JiraZephyrVersionTreeItem)zephyrExportPath).VersionId.ToString(), string.Empty);
                        }
                        else if (zephyrExportPath is JiraZephyrCycleTreeItem)
                        {
                            exportRes = ((JiraCore)this.AlmCore).ExportBfToZephyr(businessFlow, testCaseFields, testSetFields,
                                                                                  testExecutionFields, ref responseStr,
                                                                                  ((JiraZephyrCycleTreeItem)zephyrExportPath).VersionId.ToString(),
                                                                                  ((JiraZephyrCycleTreeItem)zephyrExportPath).Id.ToString());
                        }
                        break;

                    default:
                        exportRes = ((JiraCore)this.AlmCore).ExportBfToAlm(businessFlow, testCaseFields, testSetFields, testExecutionFields, ref responseStr);
                        break;
                    }

                    if (exportRes)
                    {
                        if (performSaveAfterExport)
                        {
                            Reporter.ToStatus(eStatusMsgKey.SaveItem, null, businessFlow.Name, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow));
                            WorkSpace.Instance.SolutionRepository.SaveRepositoryItem(businessFlow);
                            Reporter.HideStatusMessage();
                        }
                        if (almConectStyle != eALMConnectType.Auto && almConectStyle != eALMConnectType.Silence)
                        {
                            Reporter.ToUser(eUserMsgKey.ExportItemToALMSucceed);
                        }
                        return(true);
                    }
                    else if (almConectStyle != eALMConnectType.Auto && almConectStyle != eALMConnectType.Silence)
                    {
                        Reporter.ToUser(eUserMsgKey.ExportItemToALMFailed, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), businessFlow.Name, responseStr);
                    }
                }
                Reporter.HideStatusMessage();
            }
            return(result);
        }