/// <summary> /// get a test case id. If the test case does not exist then create one /// </summary> /// <param name="testName"></param> /// <returns>a valid test case id or 0 in case of failure</returns> public int GetTestCaseId(string testName) { int TCaseId = getTestCaseByName(testName, testSuiteId); if (TCaseId == 0) { // need to create test case GeneralResult result = proxy.CreateTestCase(connectionData.UserId, testSuiteId, testName, testProjectId, "Automated TestCase", new TestStep[0], "", 0, true, ActionOnDuplicatedName.Block, 2, 2); TCaseId = result.additionalInfo.id; int tcExternalId = result.additionalInfo.external_id; if (result.status == false) { Console.Error.WriteLine("Failed to create TestCase for {0}", testName); Console.Error.WriteLine(" Reason {0}", result.message); return(0); } string externalId = string.Format("{0}-{1}", currentProject.prefix, tcExternalId); int featureId = proxy.addTestCaseToTestPlan(currentProject.id, testPlanId, externalId, result.additionalInfo.version_number); if (featureId == 0) { Console.Error.WriteLine("Failed to assign TestCase {0} to testplan", testName); return(0); } } return(TCaseId); }
/// <summary> /// record a result with testlink; /// </summary> /// <param name="testCaseId"></param> /// <param name="status"></param> /// <param name="notes"></param> /// <returns></returns> public GeneralResult RecordTheResult(int testCaseId, TestCaseResultStatus status, string notes) { GeneralResult result = null; if (ConnectionValid == true) { result = proxy.ReportTCResult(testCaseId, testPlanId, status, platformName: platformName, notes: notes.ToString()); } else { result = new GeneralResult("Invalid Connection", false); } return(result); }
/// <summary> /// record a result with testlink; /// </summary> /// <returns></returns> public GeneralResult RecordTheResult(string testName, string testSuite, TestCaseResultStatus status, string notes) { GeneralResult result = null; if (ConnectionValid == true) { int testCaseId = AddTestIfNotExisting(testName, testSuite); if (testCaseId == 0) { result = new GeneralResult("Unable to find/add testcase", false); } else { result = proxy.ReportTCResult(testCaseId, projectData.TestplanId, status, platformName: projectData.Platform, notes: notes.ToString(), buildid: projectData.BuildId); } } else { result = new GeneralResult("Invalid Connection", false); } return(result); }
/// <summary> /// create a new project /// </summary> /// <param name="projectname"></param> /// <param name="testcasePrefix">prefix for test case ids</param> /// <param name="notes"></param> /// <returns>a general result</returns> public GeneralResult CreateProject(string projectname, string testcasePrefix, string notes = "") { GeneralResult result = null; stateIsValid(); object o = proxy.createTestProject(devkey, projectname, testcasePrefix, notes); handleErrorMessage(o); object[] olist = o as object[]; if (olist != null) { result = new GeneralResult(olist[0] as XmlRpcStruct); } return result; }
private GeneralResult handleReportTCResult(object response) { if (response is object[]) { object[] responseList = response as object[]; if (responseList.Length > 0) { XmlRpcStruct msg = (XmlRpcStruct)responseList[0]; GeneralResult result = new GeneralResult(msg); return result; } } GeneralResult noResult = new GeneralResult(); return noResult; }
/// <summary> /// record a result with testlink; /// </summary> /// <param name="testCaseId"></param> /// <param name="status"></param> /// <param name="notes"></param> /// <returns></returns> public GeneralResult RecordTheResult(int testCaseId, TestCaseResultStatus status, string notes) { GeneralResult result = null; if (ConnectionValid == true) result = proxy.ReportTCResult(testCaseId, testPlanId, status, platformName: platformName, notes: notes.ToString()); else result = new GeneralResult("Invalid Connection", false); return result; }