public void createAUniqueTestCase() { string uniqueName = string.Format("unitTest created at {0}", DateTime.Now); TestStep[] steps = new TestStep[3]; steps[0] = new TestStep(1, "<p>Step 1</p>", "<p>result 1</p>", true, 1); steps[1] = new TestStep(2, "<p>Step 2</p>", "<p>result 2</p>", true, 1); steps[2] = new TestStep(3, "<p>Step 3</p>", "<p>result 3</p>", true, 1); GeneralResult result = proxy.CreateTestCase(userName, BusinessRulesTestSuiteId, uniqueName, ApiTestProjectId, "This is a summary", steps, "auto,positive", 0, true, ActionOnDuplicatedName.CreateNewVersion, 2, 2); Assert.AreEqual(true, result.status); Assert.AreEqual("Success!", result.message); Assert.AreEqual("createTestCase", result.operation); Assert.AreEqual("", result.additionalInfo.new_name); Assert.AreEqual(true, result.additionalInfo.status_ok); Assert.AreEqual("ok", result.additionalInfo.msg); Assert.AreEqual(1, result.additionalInfo.version_number); Assert.AreEqual(false, result.additionalInfo.has_duplicate); }
/// <summary> /// Create a new Test Case /// </summary> /// <param name="authorLogin">login id of test case author</param> /// <param name="testsuiteid">Id of test suite</param> /// <param name="testcasename">name of test case</param> /// <param name="testprojectid">id of test project</param> /// <param name="summary">summary of result</param> /// <param name="steps">Array of test steps</param> /// <param name="keywords"></param> /// <param name="order">defaultOrder = 0, otherwise location in sequence to other testcases</param> /// <param name="checkduplicatedname">1=yes, 0=no</param> /// <param name="actiononduplicatedname">one of block, generate_new, create_new_version</param> /// <param name="executiontype">manual:1, automated: 2, </param> /// <param name="importance">Importance of test case</param> public GeneralResult CreateTestCase(string authorLogin, int testsuiteid, string testcasename, int testprojectid, string summary, TestStep[] steps, string keywords, int order, bool checkduplicatedname, ActionOnDuplicatedName actiononduplicatedname, int executiontype, int importance) { string actionFlag = "block"; switch (actiononduplicatedname) { case ActionOnDuplicatedName.Block: actionFlag = "block"; break; case ActionOnDuplicatedName.CreateNewVersion: actionFlag = "create_new_version"; break; case ActionOnDuplicatedName.GenerateNew: actionFlag = "generate_new"; break; } stateIsValid(); object response = proxy.createTestCase(devkey, authorLogin, testsuiteid, testcasename, testprojectid, summary, steps, keywords, order, checkduplicatedname ? 1 : 0, actionFlag, executiontype, importance); handleErrorMessage(response); if (response is object[]) { object[] list = response as object[]; foreach (XmlRpcStruct data in list) return new GeneralResult(data); } return null; }
public void VersionIncrementTest() { string tcName = "version Number test case"; GeneralResult result = proxy.CreateTestCase(userName, BusinessRulesTestSuiteId, tcName, ApiTestProjectId, "This is a summary for an externally created test case", "auto,positive", 0, true, ActionOnDuplicatedName.CreateNewVersion , 2, 2); int versionNumber = result.additionalInfo.version_number; Console.WriteLine("Version Number first pass: {0}", result.additionalInfo.version_number); TestStep[] steps = new TestStep[3]; steps[0] = new TestStep(1, "<p>Step 1</p>", "<p>result 1</p>", true, 1); steps[1] = new TestStep(2, "<p>Step 2</p>", "<p>result 2</p>", true, 2); steps[2] = new TestStep(3, "<p>Step 3</p>", "<p>result 3</p>", true, 1); result = proxy.CreateTestCase(userName, BusinessRulesTestSuiteId, tcName, ApiTestProjectId, "This is a different summary for an externally created test case", steps, "auto,positive", 0, true, ActionOnDuplicatedName.CreateNewVersion, 2, 2); Console.WriteLine("Version Number second pass: {0}", result.additionalInfo.version_number); Assert.AreEqual(versionNumber + 1, result.additionalInfo.version_number, "Version number should have been incremented"); }