简体   繁体   English

使用Java Rally Rest API向测试集添加200多个测试用例

[英]Add More than 200 Test Cases to Test Set Using Java Rally Rest API

Using Following Code I am able to add test cases in to newly created test set in RALLY. 使用以下代码我可以将测试用例添加到RALLY中新创建的测试集中。 But it add only first 200 test cases from the Test case list. 但它只从测试用例列表中添加了前200个测试用例。

private static String createTestSet(RallyRestApi restApi, String TSName, String points)throws IOException, URISyntaxException {
  QueryRequest testcases = new QueryRequest("Test Case");
  testcases.setFetch(new Fetch("FormattedID", "Name", "Owner","Test Folder"));
  // All Test cases
  testcases.setQueryFilter(new QueryFilter("TestFolder.Name", "=","testFolder").and(new QueryFilter("Method", "=", "Manual")));

  testcases.setOrder("FormattedID ASC");
  QueryResponse queryResponse = restApi.query(testcases);
  JsonArray testCaseList = new JsonArray();
  if (queryResponse.wasSuccessful()) {
    System.out.println(String.format("\nTotal results: %d", queryResponse.getTotalResultCount()));
    testCaseList=queryResponse.getResults().getAsJsonArray();
  }else{
    for (String err : queryResponse.getErrors()) {
      System.err.println("\t" + err);
    }
  }

  String ref = "null";
  System.out.println("Creating TestSet: "+TSName);
  try {
    if(!testCaseList.isJsonNull()){
      restApi.setApplicationName("PSN");
      JsonObject newTS = new JsonObject();
      newTS.addProperty("Name", TSName);
      newTS.addProperty("PlanEstimate", points);
      newTS.addProperty("Project", Project_ID);
      newTS.addProperty("Release", Release_ID);
      newTS.addProperty("Iteration", Iteration_ID);
      newTS.add("TestCases", testCaseList);
      CreateRequest createRequest = new CreateRequest("testset",newTS);
      CreateResponse createResponse = restApi.create(createRequest);
      ref = createResponse.getObject().get("_ref").getAsString();
    }
  } catch (Exception e) {
    //System.out.println("Exception Caught: " + e.getMessage());
  }
  return ref;
}

Although the Total Result count of Test case query filter is greater than 200, Test Set is getting created with only 200 Test case in it. 虽然测试用例查询过滤器的总结果计数大于200,但测试集的创建只包含200个测试用例。

@Brian's comment above is correct. @ Brian上面的评论是正确的。 By default RallyRestApi.query () will only return one page of data (with the default page size being 200). 默认情况下, RallyRestApi.query ()只返回一页数据(默认页面大小为200)。 QueryResponse.getTotalResultCount () will return the total number of records that matched on the server. QueryResponse.getTotalResultCount ()将返回服务器上匹配的记录总数。 In order to get more than one page of data simply use QueryRequest.setLimit () first to set an upper bound on the number of results you'd like returned. 为了获得多页数据,首先只需使用QueryRequest.setLimit ()来设置您想要返回的结果数的上限。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Java Rally Rest API将测试用例添加到Rally中的TestSet中 - Adding test cases into TestSets in rally using Java Rally Rest API 无法使用Java Rally Rest API创建测试集 - Unable to create Test Set Using Java Rally Rest API 使用Java批量删除Rally测试用例 - Bulk Deletion of Rally Test Cases using Java 使用Rally Rest API和Java创建新测试用例时无法添加新标签 - Unable to add new tags on creation of new test case using rally rest api and java 是否可以使用Java rally REST API在Rally中将图像文件附加到测试用例结果? - Is it possible to attach an image file to the test case result in Rally using Java rally REST API? Rally:Java:我在一个测试文件夹中有几个测试文件夹,所有文件夹都有测试用例。 如何使用java api获取所有测试用例 - Rally: Java: I have few test folders inside a test folder and all folders have test cases. How to get all the test cases using java api 当工作空间与帐户上的默认设置不同时,使用Java Rally Rest API插入测试用例结果失败 - Inserting test case result using Java Rally Rest API failing when workspace is different from default set on account 使用Rest API更新测试用例结果 - Rally Test case result update using Rest API 使用 mockito for Rest API 的 JUnit 测试用例 - JUnit test cases using mockito for Rest API 在Rally中如何获取测试集中测试用例的执行状态 - In Rally how to fetch execution status of test cases in test set
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM