如何将新测试用例添加到现有的Rally文件夹

时间:2014-02-12 04:13:35

标签: rally

我尝试使用以下代码在现有文件夹下创建测试用例。我能够创建测试用例,但不会在相关文件夹下看到它。

    QueryRequest testFolderRequest = new QueryRequest("TestFolder");
    testFolderRequest .setFetch(new Fetch("FormattedID", "Name"));

    QueryResponse testFolderQueryResponse = restApi.query(testsetRequest);
    // JsonObject testSetJsonObject =
    // testSetQueryResponse.getResults().get(0).getAsJsonObject();
    String testFolderReference = testFolderQueryResponse.getResults().get(0)
            .getAsJsonObject().get("_ref").toString();
    // System.out.println("TestFolder object: "+testSetRef);

    JsonObject newTestCase = new JsonObject();
    newTestCase.addProperty("Name", "Newly added testcase in a folder");
    newTestCase.addProperty("Test Folder", testFolderReference);
    CreateRequest createRequest = new CreateRequest("testcase", newTestCase);
    CreateResponse response = restApi.create(createRequest);
    System.out.println(response.toString());
    JsonObject json = response.getObject();
    System.out.println(json);

1 个答案:

答案 0 :(得分:0)

webservices API中的属性不应包含空格。所以:

newTestCase.addProperty("TestFolder", testFolderReference);

应该工作。