我有以下Java代碼(下面)來更新我的測試用例。我想更新我的測試用例中的三個字段。三個字段是項目,測試文件夾和筆記。代碼在工作時只會更新項目和註釋字段。測試文件夾字段保持不變。爲了讓它更新我的測試文件夾字段,需要進行哪些更改? 感謝拉力賽:在測試用例中更新測試文件夾
import com.google.gson.JsonObject;
import com.rallydev.rest.RallyRestApi;
import com.rallydev.rest.request.CreateRequest;
import com.rallydev.rest.request.UpdateRequest;
import com.rallydev.rest.response.CreateResponse;
import com.rallydev.rest.response.UpdateResponse;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.rallydev.rest.RallyRestApi;
import com.rallydev.rest.request.CreateRequest;
import com.rallydev.rest.request.DeleteRequest;
import com.rallydev.rest.request.GetRequest;
import com.rallydev.rest.request.QueryRequest;
import com.rallydev.rest.request.UpdateRequest;
import com.rallydev.rest.response.CreateResponse;
import com.rallydev.rest.response.DeleteResponse;
import com.rallydev.rest.response.GetResponse;
import com.rallydev.rest.response.QueryResponse;
import com.rallydev.rest.response.UpdateResponse;
import com.rallydev.rest.util.Fetch;
import com.rallydev.rest.util.QueryFilter;
import com.rallydev.rest.util.Ref;
import com.rallydev.rest.util.Ref;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import com.rallydev.rest.RallyRestApi;
public class TestCaseUpdate {
// TODO Auto-generated constructor stub
public static void main(String[] args) throws URISyntaxException, IOException {
String host = "https://rally1.rallydev.com";
String username = "[email protected]";
String password = "secret";
String wsapiVersion = "v2.0";
String projectRef = "/project/387xxxx.js";
String tfRef = "/testfolder/198xxx.js";
//String tfRef = "/testfolders/198xxx.js";
String applicationName = "RestExample_createTFandTC";
RallyRestApi restApi = new RallyRestApi(
new URI(host),
username,
password);
restApi.setWsapiVersion(wsapiVersion);
restApi.setApplicationName(applicationName);
JsonObject tcUpdate = new JsonObject();
tcUpdate.addProperty("Notes", "Fixed3");
tcUpdate.addProperty("Project", projectRef);
tcUpdate.addProperty("Test Folder", tfRef);
UpdateRequest updateRequest = new UpdateRequest("/testcase/186xxx.js", tcUpdate);
UpdateResponse updateResponse = restApi.update(updateRequest);
if (updateResponse.wasSuccessful()) {
System.out.println("Successfully updated test case: ");
} else {
System.out.println("Error");
}
}
}