我正在尝试更新拉力赛测试用例。我能够更新现有的测试用例名称,我也想更新测试步骤。是否有可能更新拉力赛现有的测试步骤? 我试过下面的代码,并成功地更新了测试用例'name',但不是测试步骤如何更新拉力赛测试用例步骤
感谢您在这方面的帮助。
private void updateTestCase
{
JsonObject newTestCase = new JsonObject();
newTestCase.addProperty("Name",
"Latest case to add Test Case Attributes");
newTestCase.addProperty("Method", "Automated");
CreateRequest createRequest = new CreateRequest("testcase", newTestCase);
CreateResponse response = restApi.create(createRequest);
System.out.println(response.toString());
JsonObject json = response.getObject();
System.out.println(json);
JsonObject updatedName = new JsonObject();
updatedName.addProperty("Name", "Test Case Name newly Updated");
// String testCaseObjectId = json.get("ObjectID").getAsString();
String testCaseObjectId = "17456494683";
UpdateRequest updateTestCase = new UpdateRequest("/testcase/"
+ testCaseObjectId, updatedName);
UpdateResponse updateTCResponse = restApi.update(updateTestCase);
if (updateTCResponse.wasSuccessful()) {
System.out.println("Tag succeccfully added to the test case");
}
JsonObject stepOne = new JsonObject();
JsonObject stepTwo = new JsonObject();
// Update test case for the test case
stepOne.addProperty("Input", "Open Database Connection");
stepOne.addProperty("TestCase", "/testcase/" + testCaseObjectId);
stepTwo.addProperty("Input", "Verify the Target Schema Specified");
stepTwo.addProperty("TestCase", "/testcase/" + testCaseObjectId);
UpdateRequest stepUpdateRequest1 = new UpdateRequest("TestCaseStep",
stepOne);
restApi.update(stepUpdateRequest1);
UpdateRequest createUpdateRequest2 = new UpdateRequest("TestCaseStep",
stepTwo);
restApi.update(createUpdateRequest2);
}
我收到以下错误:
Exception in thread "main" java.lang.NullPointerException: key == null
at com.google.gson.internal.LinkedTreeMap.put(LinkedTreeMap.java:92)
at com.google.gson.JsonObject.add(JsonObject.java:57)
at com.rallydev.rest.request.UpdateRequest.getBody(UpdateRequest.java:41)
at com.rallydev.rest.RallyRestApi.update(RallyRestApi.java:189)
at com.rallydev.rest.RallyRestApi.update(RallyRestApi.java:185)
at com.ags.rally.App.createTestCase(App.java:169)
at com.ags.rally.App.main(App.java:102)
问候, 基兰
任何一个可以请让我知道,如果测试步骤更新用是可能的吗? – kiran