Esempio n. 1
0
        public QtestTestSuite ImportTestSetData(QtestTestSuite TS)
        {
            ConnectALMServer();
            testrunApi  = new QTestApi.TestrunApi(connObj.Configuration);
            testcaseApi = new QTestApi.TestcaseApi(connObj.Configuration);

            QTestApiModel.ParameterPostQueryResponse existedParameters = null;
            try
            {
                QTestApi.ParametersApi parametersApi = new QTestApi.ParametersApi(ALMCore.DefaultAlmConfig.ALMUserName, ALMCore.DefaultAlmConfig.ALMPassword, connObj.Configuration);
                existedParameters = parametersApi.GetAllParameters((long)Convert.ToInt32(ALMCore.DefaultAlmConfig.ALMProjectKey));
            }
            catch (Exception ex)
            {
                Reporter.ToLog(eLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {ex.Message}", ex);
            }
            List <QTestApiModel.TestRunWithCustomFieldResource> testRunList = testrunApi.GetOf((long)Convert.ToInt32(ALMCore.DefaultAlmConfig.ALMProjectKey), (long)Convert.ToInt32(TS.ID), "test-suite");

            foreach (QTestApiModel.TestRunWithCustomFieldResource testRun in testRunList)
            {
                QTestApiModel.TestRunWithCustomFieldResource testRunCurrent = testrunApi.Get((long)Convert.ToInt32(ALMCore.DefaultAlmConfig.ALMProjectKey), testRun.Id, "testcase.teststep");
                QtestTest test = GetQtestTest(testRun.TestCase.Id, existedParameters, testRunCurrent.TestCase);
                test.Runs = new List <QtestTestRun>();
                test.Runs.Add(new QtestTestRun(testRun.Id.ToString(), testRun.Name, testRun.Properties[0].ToString(), testRun.CreatorId.ToString()));
                TS.Tests.Add(test);
            }

            return(TS);
        }
Esempio n. 2
0
        public QtestTest GetQtestTest(long?testID, QTestApiModel.ParameterPostQueryResponse existedParameters = null, QTestApiModel.TestCaseWithCustomFieldResource testCase = null)
        {
            testcaseApi = new QTestApi.TestcaseApi(connObj.Configuration);
            if (testCase == null)
            {
                testCase = testcaseApi.GetTestCase((long)Convert.ToInt32(ALMCore.DefaultAlmConfig.ALMProjectKey), testID);
            }

            QtestTest test = new QtestTest();

            test.Description = testCase.Description;
            test.TestName    = testCase.Name;
            test.TestID      = testCase.Id.ToString();
            foreach (QTestApiModel.TestStepResource testStep in testCase.TestSteps)
            {
                if (testStep.CalledTestCaseId != null)
                {
                    QTestApiModel.TestCaseWithCustomFieldResource calledTestCase = testcaseApi.GetTestCase((long)Convert.ToInt32(ALMCore.DefaultAlmConfig.ALMProjectKey), testStep.CalledTestCaseId);
                    calledTestCase.TestSteps.ForEach(z => test.Steps.Add(new QtestTestStep(z.Id.ToString(), StripHTML(z.Description), StripHTML(z.Expected), testStep.CalledTestCaseId.ToString())));
                }
                else
                {
                    string stepName = testStep.Description;
                    string stepDesc = testStep.Description;
                    if (testStep.Description.Contains("=>"))
                    {
                        string[] activityData = testStep.Description.Split(new[] { "=>" }, StringSplitOptions.None);
                        stepName = activityData[0];
                        stepDesc = activityData[1];
                    }
                    QtestTestStep newStep = new QtestTestStep(testStep.Id.ToString(), stepDesc, testStep.Expected, null, stepName);

                    if ((testStep.ParameterValues != null) && (testStep.ParameterValues.Count > 0) && (testStep.ParameterValues[0] != null))
                    {
                        if (existedParameters != null)
                        {
                            if (testStep.RootCalledTestCaseId != null)
                            {
                                QTestApiModel.ParameterModel currentParameter = existedParameters.Items.Where(z => z.TcIds.Contains(testStep.RootCalledTestCaseId) && z.Values.Contains(testStep.ParameterValues[0])).FirstOrDefault();
                                newStep.Params        = new QtestTestParameter();
                                newStep.Params.Value  = testStep.ParameterValues[0];
                                newStep.Params.Values = currentParameter.Values.Split(',').ToList();
                                newStep.Params.Name   = currentParameter.Description;
                            }
                        }
                    }
                    test.Steps.Add(newStep);
                }
            }

            return(test);
        }
Esempio n. 3
0
        public bool ExportActivitiesGroupToALM(ActivitiesGroup activitiesGroup, QtestTest mappedTest, string parentObjectId, ObservableList <ExternalItemFieldBase> testCaseFields, ref string result)
        {
            ConnectALMServer();
            testcaseApi = new QTestApi.TestcaseApi(connObj.Configuration);

            try
            {
                if (mappedTest == null) // Create new test case
                {
                    QTestApiModel.TestCaseWithCustomFieldResource testCase = new QTestApiModel.TestCaseWithCustomFieldResource(null, null, null, new List <QTestApiModel.PropertyResource>());
                    testCase.Description = activitiesGroup.Description;
                    testCase.Name        = activitiesGroup.Name;
                    testCase             = testcaseApi.CreateTestCase((long)Convert.ToInt32(ALMCore.DefaultAlmConfig.ALMProjectKey), testCase);
                    foreach (ActivityIdentifiers actIdent in activitiesGroup.ActivitiesIdentifiers)
                    {
                        QTestApiModel.TestStepResource stepResource = new QTestApiModel.TestStepResource(null, null,
                                                                                                         ((Activity)actIdent.IdentifiedActivity).Description == null ? string.Empty : ((Activity)actIdent.IdentifiedActivity).Description,
                                                                                                         ((Activity)actIdent.IdentifiedActivity).Expected == null ? string.Empty : ((Activity)actIdent.IdentifiedActivity).Expected);
                        stepResource.PlainValueText = ((Activity)actIdent.IdentifiedActivity).ActivityName;
                        stepResource = testcaseApi.AddTestStep((long)Convert.ToInt32(ALMCore.DefaultAlmConfig.ALMProjectKey), testCase.Id, stepResource);
                        ((Activity)actIdent.IdentifiedActivity).ExternalID  = stepResource.Id.ToString();
                        ((Activity)actIdent.IdentifiedActivity).ExternalID2 = stepResource.Id.ToString();
                    }
                    activitiesGroup.ExternalID  = testCase.Id.ToString();
                    activitiesGroup.ExternalID2 = testCase.Id.ToString();
                }
                else
                {
                    // update existing test case
                }

                return(true);
            }
            catch (Exception ex)
            {
                result = "Unexpected error occurred- " + ex.Message;
                Reporter.ToLog(eLogLevel.ERROR, "Failed to export the " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup) + " to qTest", ex);
                return(false);
            }
        }
        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);
        }
Esempio n. 5
0
        public bool ExportActivitiesGroupToALM(ActivitiesGroup activitiesGroup, QtestTest mappedTest, string parentObjectId, ObservableList <ExternalItemFieldBase> testCaseFields, ref string result)
        {
            ConnectALMServer();
            testcaseApi = new QTestApi.TestcaseApi(connObj.Configuration);

            try
            {
                if (mappedTest == null) // Create new test case
                {
                    QTestApiModel.TestCaseWithCustomFieldResource testCase = new QTestApiModel.TestCaseWithCustomFieldResource(null, null, null, new List <QTestApiModel.PropertyResource>());
                    testCase.Description = activitiesGroup.Description;
                    testCase.Name        = activitiesGroup.Name;
                    testCase.ParentId    = (long)Convert.ToInt32(parentObjectId);
                    //create testCase
                    testCase = testcaseApi.CreateTestCase((long)Convert.ToInt32(ALMCore.DefaultAlmConfig.ALMProjectKey), testCase);
                    //add testSteps
                    foreach (ActivityIdentifiers actIdent in activitiesGroup.ActivitiesIdentifiers)
                    {
                        string stepNameWithDesc = ((Activity)actIdent.IdentifiedActivity).ActivityName + "=>" + ((Activity)actIdent.IdentifiedActivity).Description;
                        QTestApiModel.TestStepResource stepResource = new QTestApiModel.TestStepResource(null, null,
                                                                                                         stepNameWithDesc,
                                                                                                         ((Activity)actIdent.IdentifiedActivity).Expected == null ? string.Empty : ((Activity)actIdent.IdentifiedActivity).Expected);
                        stepResource.PlainValueText = ((Activity)actIdent.IdentifiedActivity).ActivityName;
                        stepResource = testcaseApi.AddTestStep((long)Convert.ToInt32(ALMCore.DefaultAlmConfig.ALMProjectKey), testCase.Id, stepResource);
                        ((Activity)actIdent.IdentifiedActivity).ExternalID  = stepResource.Id.ToString();
                        ((Activity)actIdent.IdentifiedActivity).ExternalID2 = stepResource.Id.ToString();
                    }

                    //approve testCase - it needs to be called each time whenever testCase is updated
                    testcaseApi.ApproveTestCase((long)Convert.ToInt32(ALMCore.DefaultAlmConfig.ALMProjectKey), testCase.Id);

                    activitiesGroup.ExternalID  = testCase.Id.ToString();
                    activitiesGroup.ExternalID2 = testCase.Id.ToString();
                }
                else
                {
                    // update existing test case
                    QTestApiModel.TestCaseWithCustomFieldResource testCase = testcaseApi.GetTestCase((long)Convert.ToInt32(ALMCore.DefaultAlmConfig.ALMProjectKey), (long)Convert.ToInt32(mappedTest.TestID));;

                    //update testCase
                    testCase.Description = activitiesGroup.Description;
                    testCase.Name        = activitiesGroup.Name;
                    testCase             = testcaseApi.UpdateTestCase((long)Convert.ToInt32(ALMCore.DefaultAlmConfig.ALMProjectKey), testCase.Id, testCase);

                    //update steps
                    int counter = 0;
                    foreach (ActivityIdentifiers actIdent in activitiesGroup.ActivitiesIdentifiers)
                    {
                        //get testCase each time because update step changes the ids of the steps
                        testCase = testcaseApi.GetTestCase((long)Convert.ToInt32(ALMCore.DefaultAlmConfig.ALMProjectKey), (long)Convert.ToInt32(mappedTest.TestID));

                        string stepNameWithDesc = ((Activity)actIdent.IdentifiedActivity).ActivityName + "=>" + ((Activity)actIdent.IdentifiedActivity).Description;
                        QTestApiModel.TestStepResource stepResource = new QTestApiModel.TestStepResource(null, null,
                                                                                                         stepNameWithDesc,
                                                                                                         ((Activity)actIdent.IdentifiedActivity).Expected == null ? string.Empty : ((Activity)actIdent.IdentifiedActivity).Expected);
                        stepResource.PlainValueText = ((Activity)actIdent.IdentifiedActivity).ActivityName;

                        stepResource = testcaseApi.UpdateTestStep((long)Convert.ToInt32(ALMCore.DefaultAlmConfig.ALMProjectKey), testCase.Id, testCase.TestSteps[counter].Id, stepResource);
                        ((Activity)actIdent.IdentifiedActivity).ExternalID  = stepResource.Id.ToString();
                        ((Activity)actIdent.IdentifiedActivity).ExternalID2 = stepResource.Id.ToString();

                        counter++;
                    }

                    //approve testCase - it needs to be called each time whenever testCase is updated
                    testcaseApi.ApproveTestCase((long)Convert.ToInt32(ALMCore.DefaultAlmConfig.ALMProjectKey), testCase.Id);
                }

                return(true);
            }
            catch (Exception ex)
            {
                result = "Unexpected error occurred- " + ex.Message;
                Reporter.ToLog(eLogLevel.ERROR, "Failed to export the " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup) + " to qTest", ex);
                return(false);
            }
        }
Esempio n. 6
0
        public override bool ExportExecutionDetailsToALM(BusinessFlow bizFlow, ref string result, bool exectutedFromAutomateTab = false, PublishToALMConfig publishToALMConfig = null)
        {
            result = string.Empty;
            if (bizFlow.ExternalID == "0" || String.IsNullOrEmpty(bizFlow.ExternalID))
            {
                result = GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + ": " + bizFlow.Name + " is missing ExternalID, cannot locate QC TestSet without External ID";
                return(false);
            }

            try
            {
                //get the BF matching test set
                ConnectALMServer();
                testcaseApi = new QTestApi.TestcaseApi(connObj.Configuration);
                testrunApi  = new QTestApi.TestrunApi(connObj.Configuration);
                QTestApi.TestlogApi    testlogApi    = new QTestApi.TestlogApi(connObj.Configuration);
                QTestApi.AttachmentApi attachmentApi = new QTestApi.AttachmentApi(connObj.Configuration);

                QtestTestSuite testSuite = GetQtestTestSuite(bizFlow.ExternalID);
                if (testSuite != null)
                {
                    //get all BF Activities groups
                    ObservableList <ActivitiesGroup> activGroups = bizFlow.ActivitiesGroups;
                    if (activGroups.Count > 0)
                    {
                        foreach (ActivitiesGroup activGroup in activGroups)
                        {
                            if ((publishToALMConfig.FilterStatus == FilterByStatus.OnlyPassed && activGroup.RunStatus == eActivitiesGroupRunStatus.Passed) ||
                                (publishToALMConfig.FilterStatus == FilterByStatus.OnlyFailed && activGroup.RunStatus == eActivitiesGroupRunStatus.Failed) ||
                                publishToALMConfig.FilterStatus == FilterByStatus.All)
                            {
                                QtestTest tsTest = null;
                                //go by TC ID = TC Instance ID
                                tsTest = testSuite.Tests.Where(x => x.TestID == activGroup.ExternalID).FirstOrDefault();
                                if (tsTest != null)
                                {
                                    //get activities in group
                                    List <Activity> activities   = (bizFlow.Activities.Where(x => x.ActivitiesGroupID == activGroup.Name)).Select(a => a).ToList();
                                    string          TestCaseName = PathHelper.CleanInValidPathChars(tsTest.TestName);
                                    if ((publishToALMConfig.VariableForTCRunName == null) || (publishToALMConfig.VariableForTCRunName == string.Empty))
                                    {
                                        String timeStamp = DateTime.Now.ToString("dd-MMM-yyyy HH:mm:ss");
                                        publishToALMConfig.VariableForTCRunName = "GingerRun_" + timeStamp;
                                    }


                                    if (tsTest.Runs[0] != null)
                                    {
                                        List <QTestApiModel.StatusResource> statuses      = testrunApi.GetStatusValuable((long)Convert.ToInt32(ALMCore.DefaultAlmConfig.ALMProjectKey));
                                        List <QTestApiModel.StatusResource> stepsStatuses = new List <QTestApiModel.StatusResource>();
                                        QTestApiModel.StatusResource        testCaseStatus;

                                        QTestApiModel.TestRunWithCustomFieldResource testRun      = testrunApi.Get((long)Convert.ToInt32(ALMCore.DefaultAlmConfig.ALMProjectKey), (long)Convert.ToInt32(tsTest.Runs[0].RunID), "descendents");
                                        List <QTestApiModel.TestStepLogResource>     testStepLogs = new List <QTestApiModel.TestStepLogResource>();

                                        QTestApiModel.TestCaseWithCustomFieldResource testCase = testcaseApi.GetTestCase((long)Convert.ToInt32(ALMCore.DefaultAlmConfig.ALMProjectKey), testRun.TestCase.Id);
                                        int testStepsCount = 0;
                                        foreach (QTestApiModel.TestStepResource step in testCase.TestSteps)
                                        {
                                            if (step.CalledTestCaseId != null)
                                            {
                                                QTestApiModel.TestCaseWithCustomFieldResource calledTestCase = testcaseApi.GetTestCase((long)Convert.ToInt32(ALMCore.DefaultAlmConfig.ALMProjectKey), step.CalledTestCaseId);
                                                foreach (QTestApiModel.TestStepResource nestedStep in calledTestCase.TestSteps)
                                                {
                                                    Activity matchingActivity = activities.Where(x => x.ExternalID == nestedStep.Id.ToString()).FirstOrDefault();
                                                    if (matchingActivity != null)
                                                    {
                                                        QTestApiModel.TestStepLogResource testStepLog = new QTestApiModel.TestStepLogResource(null, nestedStep.Id);
                                                        testStepLog.CalledTestCaseId = step.CalledTestCaseId;
                                                        testStepLog.ParentTestStepId = step.Id;
                                                        testStepLog.ActualResult     = string.Empty;
                                                        SetTestStepLogStatus(matchingActivity, ref testStepLog, statuses);
                                                        stepsStatuses.Add(testStepLog.Status);
                                                        testStepLogs.Add(testStepLog);
                                                        testStepsCount++;
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                Activity matchingActivity = activities.Where(x => x.ExternalID == step.Id.ToString()).FirstOrDefault();
                                                if (matchingActivity != null)
                                                {
                                                    QTestApiModel.TestStepLogResource testStepLog = new QTestApiModel.TestStepLogResource(null, step.Id);
                                                    testStepLog.ActualResult = string.Empty;
                                                    SetTestStepLogStatus(matchingActivity, ref testStepLog, statuses);
                                                    stepsStatuses.Add(testStepLog.Status);
                                                    testStepLogs.Add(testStepLog);
                                                    testStepsCount++;
                                                }
                                            }
                                        }

                                        //update the TC general status based on the activities status collection.
                                        if (stepsStatuses.Where(x => x.Name == "Failed").Count() > 0)
                                        {
                                            testCaseStatus = statuses.Where(z => z.Name == "Failed").FirstOrDefault();
                                        }
                                        else if (stepsStatuses.Where(x => x.Name == "No Run").Count() == testStepsCount || stepsStatuses.Where(x => x.Name == "Not Applicable").Count() == testStepsCount)
                                        {
                                            testCaseStatus = statuses.Where(z => z.Name == "Unexecuted").FirstOrDefault();
                                        }
                                        else if (stepsStatuses.Where(x => x.Name == "Passed").Count() == testStepsCount || (stepsStatuses.Where(x => x.Name == "Passed").Count() + stepsStatuses.Where(x => x.Name == "Unexecuted").Count()) == testStepsCount)
                                        {
                                            testCaseStatus = statuses.Where(z => z.Name == "Passed").FirstOrDefault();
                                        }
                                        else
                                        {
                                            testCaseStatus = statuses.Where(z => z.Name == "Unexecuted").FirstOrDefault();
                                        }

                                        QTestApiModel.ManualTestLogResource automationTestLog = new QTestApiModel.ManualTestLogResource(null, null, DateTime.Parse(bizFlow.StartTimeStamp.ToUniversalTime().ToString("yyyy-MM-dd'T'HH:mm:sszz:00")), DateTime.Parse(bizFlow.EndTimeStamp.ToUniversalTime().ToString("yyyy-MM-dd'T'HH:mm:sszz:00")),
                                                                                                                                        null, null, tsTest.TestName + " - execution", null, null,
                                                                                                                                        null, null, null, testCaseStatus, null, testStepLogs);

                                        QTestApiModel.TestLogResource testLog = testlogApi.SubmitTestLog((long)Convert.ToInt32(ALMCore.DefaultAlmConfig.ALMProjectKey), automationTestLog, (long)Convert.ToInt32(tsTest.Runs[0].RunID));

                                        // Attach ActivityGroup Report if needed
                                        if (publishToALMConfig.ToAttachActivitiesGroupReport)
                                        {
                                            if ((activGroup.TempReportFolder != null) && (activGroup.TempReportFolder != string.Empty) &&
                                                (System.IO.Directory.Exists(activGroup.TempReportFolder)))
                                            {
                                                //Creating the Zip file - start
                                                string targetZipPath = System.IO.Directory.GetParent(activGroup.TempReportFolder).ToString();
                                                string zipFileName   = targetZipPath + "\\" + TestCaseName + "_GingerHTMLReport.zip";

                                                if (!System.IO.File.Exists(zipFileName))
                                                {
                                                    ZipFile.CreateFromDirectory(activGroup.TempReportFolder, zipFileName);
                                                }
                                                else
                                                {
                                                    System.IO.File.Delete(zipFileName);
                                                    ZipFile.CreateFromDirectory(activGroup.TempReportFolder, zipFileName);
                                                }
                                                System.IO.Directory.Delete(activGroup.TempReportFolder, true);
                                                // to discuss an issue
                                                attachmentApi.Upload((long)Convert.ToInt32(ALMCore.DefaultAlmConfig.ALMProjectKey), "test-logs", testLog.Id, "GingerExecutionHTMLReport.zip", "application/x-zip-compressed", File.ReadAllBytes(zipFileName));
                                                System.IO.File.Delete(zipFileName);
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    //No matching TC was found for the ActivitiesGroup in QC
                                    result = "Matching TC's were not found for all " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroups) + " in qTest.";
                                }
                            }
                        }
                    }
                    else
                    {
                        //No matching Test Set was found for the BF in QC
                        result = "No matching Test Set was found in qTest.";
                    }
                }
                if (result == string.Empty)
                {
                    result = "Export performed successfully.";
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                result = "Unexpected error occurred- " + ex.Message;
                Reporter.ToLog(eLogLevel.ERROR, "Failed to export execution details to Qtest", ex);
                return(false);
            }
        }