/// <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; } }
/// <summary> /// Check whether is there an test environment in RQM, if not, create one /// </summary> /// <param name="projectAlias">project alias</param> /// <param name="title">title of environment</param> /// <param name="description">description of environment</param> /// <param name="xmlConfig">the xml config of the environment</param> /// <returns>the generated id of the environment</returns> public string GetOrCreateTestEnvironment(string projectAlias, string title, string description, string xmlConfig) { Resources.configuration config = new Resources.configuration(); config.name = title; config.title = title; config.summary = description; config.description = ConvertXElementToXMLNode(XElement.Parse(xmlConfig)); return GetOrCreateResourceByTitle(projectAlias, config); }