Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/395.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/rest/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法在使用rally rest api和java创建新测试用例时添加新标记_Java_Rest_Api_Rally - Fatal编程技术网

无法在使用rally rest api和java创建新测试用例时添加新标记

无法在使用rally rest api和java创建新测试用例时添加新标记,java,rest,api,rally,Java,Rest,Api,Rally,在使用rally rest api(JAVA)创建新的测试用例时,我使用下面的代码在标记字段中添加标记。 但是标记不会添加到rally中的标记字段中。请帮帮我 String tags = "@tag1 ,@tag2"; JsonArray testcases = new JsonArray(); JsonObject newtestcase = new JsonObject(); newTestCase.addProperty("Name" , TestCaseN

在使用rally rest api(JAVA)创建新的测试用例时,我使用下面的代码在标记字段中添加标记。 但是标记不会添加到rally中的标记字段中。请帮帮我

    String tags = "@tag1 ,@tag2";
    JsonArray testcases = new JsonArray();
    JsonObject newtestcase = new JsonObject();
    newTestCase.addProperty("Name" , TestCaseName);
    newTestCase.addProperty("Method" , Manual);
    JsonArray arr1= new JsonArray();
    arr1.add(tags);
    newTestCase.addProperty("Tags" , tags);
  Createrequest createrequest = new Createrequest("TestCase" , newTestCase);
    JsonObject testcase = new JsonObject();
    testcase.addProperty("_ref" , ref);
    testcases.add(testcase);

您需要通过标记的ref来引用标记,就像WSAPI中的任何其他对象一样

JsonArray tags = new JsonArray();

JsonObject tag1 = new JsonObject();
tag1.addProperty("_ref", "/tag/12345");
tags.add(tag1);

JsonObject tag2 = new JsonObject();
tag2.addProperty("_ref", "/tag/23456");
tags.add(tag2);

newTestcase.addProperty("Tags", tags);

按照以下步骤使用标记名创建标记

首先使用下面的url和post方法分别创建标记

https://rally1.rallydev.com/slm/webservice/v2.0/tag/create
使用下面的标记结构执行post请求

{"Tag:{"Name": "@tag1"}}

将为标记创建引用对象。您可以使用标记的ref url(/tag/12345),并将其添加到ref链接中的测试用例中

:/tag/12345,12345是标记的对象id,因此请告诉我如何添加标记名正确的标记。不能按名称添加标记。您必须首先按名称查询标记,然后使用它们的引用。嗨,Kyle Morse,谢谢,上面的方法适用于已经存在的标记。使用“/tag/12345”,我可以为测试用例重新使用可用的标记。请让我知道,如何在创建新的测试用例时创建新的标记。没有办法一步完成。你必须先创建标签,然后以同样的方式引用它们。谢谢Kyle Morse,我可以添加带有标签名的标签