Exemplo n.º 1
0
        /// <summary>
        /// Create test plan in RQM
        /// </summary>
        /// <param name="projectAlias">project to create test plan on</param>
        /// <param name="title">test plan title</param>
        /// <param name="description">test plan description</param>
        /// <param name="testCaseWebIds">the list of test cases' web ids to be included in the test plan</param>
        /// <returns>the web id of the created test plan</returns>
        public string CreateTestPlan(string projectAlias, string title, string description, string[] testCaseWebIds, string[] testEnvironmentGeneratedIds)
        {
            Resources.testplan testPlan = new Resources.testplan();
            testPlan.title = title;
            testPlan.description = description;

            testPlan.template = new Resources.testplanTemplate();
            testPlan.template.href = string.Format("{0}/{1}/resources/{2}/testplan/{3}", Url, RQMRESTfulUrl, projectAlias, "com.ibm.rqm.planning.templates.testplan.template_1395123161408");

            //test cases
            int count = testCaseWebIds.Count();
            testPlan.testcase = new Resources.testplanTestcase[count];
            for (int i = 0; i < count; i++)
            {
                string webId = testCaseWebIds[i];
                testPlan.testcase[i] = new Resources.testplanTestcase();
                testPlan.testcase[i].href = GetResourceURLForGettingAndPuttingUsingWebId(projectAlias, new Resources.testcase(), webId);
            }

            //test environments
            testPlan.configuration = new Resources.testplanConfiguration[testEnvironmentGeneratedIds.Count()];
            for (int i = 0; i < testEnvironmentGeneratedIds.Count(); i++)
            {
                testPlan.configuration[i] = new Resources.testplanConfiguration();
                testPlan.configuration[i].href = GetResourceURLForGettingAndPuttingUsingGeneratedId(projectAlias, new Resources.configuration(), testEnvironmentGeneratedIds[i]);
            }

            return CreateResourceByPost(projectAlias, testPlan);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get the execution record based on the combination of test case, test plan, test environment(configuration)
        /// Note that, typically, the combination of case/plan/config/timeline dertimine one execution record, here we ignored the timeline.
        /// </summary>
        /// <param name="projectAlias"></param>
        /// <param name="caseWebId">test case WebId</param>
        /// <param name="planWebId">test plan WebId</param>
        /// <param name="environmentGeneratedId">environment Generated Id</param>
        /// <returns>list of execution records</returns>
        private List<Resources.executionworkitem> GetExistingExecutionRecordsInRQMByTestCaseTestPlanAndEnvironment(string projectAlias, string caseWebId, string planWebId, string environmentGeneratedId)
        {
            Resources.testcase testCase = new Resources.testcase();
            string testCaseURL = GetResourceURLForGettingAndPuttingUsingWebId(projectAlias,testCase, caseWebId);

            Resources.testplan testPlan = new Resources.testplan();
            string testPlanURL = GetResourceURLForGettingAndPuttingUsingWebId(projectAlias, testPlan, planWebId);

            Resources.configuration config = new Resources.configuration();
            string configURL = GetResourceURLForGettingAndPuttingUsingGeneratedId(projectAlias, config, environmentGeneratedId);

            Resources.executionworkitem item = new Resources.executionworkitem();
            string requestURL = GetResourcesURLForPosting(projectAlias, item);
            requestURL = string.Format("{0}?fields=feed/entry/content/{1}/(*|testcase[@href='{2}']|testplan[@href='{3}']|configuration[@href='{4}'])",requestURL,item.GetType().Name, testCaseURL, testPlanURL, configURL );

            List<object> executionRecords = GetResourcesByURL(requestURL, item);
            if (executionRecords != null)
            {
                return executionRecords.Select(e => e as Resources.executionworkitem).ToList();
            }
            else
            {
                return null;
            }
        }