我正在嘗試更新拉力賽測試用例。我能夠更新現有的測試用例名稱,我也想更新測試步驟。是否有可能更新拉力賽現有的測試步驟? 我試過下面的代碼,併成功地更新了測試用例'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