- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我一直在努力向 Rally 中的测试用例添加标签。该标记已存在于 Tags 集合中。但我不能将它添加到测试用例中。有人可以提供有关如何执行此操作的示例吗?
非常感谢。
最佳答案
这是一个如何执行此操作的示例 - 该示例显示了向现有测试用例添加标签,以及创建新测试用例和向新测试用例添加标签。
public class RestExample_AddTagsToTestCase {
public static void main(String[] args) throws URISyntaxException, IOException {
// Create and configure a new instance of RallyRestApi
// Connection parameters
String rallyURL = "https://rally1.rallydev.com";
String wsapiVersion = "1.34";
String applicationName = "RestExample_AddTagsToTestCase";
// Credentials
String userName = "user@company.com";
String userPassword = "password";
RallyRestApi restApi = new RallyRestApi(
new URI(rallyURL),
userName,
userPassword);
restApi.setWsapiVersion(wsapiVersion);
restApi.setApplicationName(applicationName);
// User settings
String testerUserName = "tester@company.com";
// Workspace and Project Settings
String myWorkspace = "My Workspace";
String myProject = "My Project";
// FormattedID of Existing Test Case to Query
String existTestCaseFormattedID = "TC172";
// Tag Names of Interest
String tagNameAlpine = "Alpine";
String tagNameMontane = "Montane";
//Read User
QueryRequest userRequest = new QueryRequest("User");
userRequest.setFetch(new Fetch("UserName", "Subscription", "DisplayName"));
userRequest.setQueryFilter(new QueryFilter("UserName", "=", testerUserName));
QueryResponse userQueryResponse = restApi.query(userRequest);
JsonArray userQueryResults = userQueryResponse.getResults();
JsonElement userQueryElement = userQueryResults.get(0);
JsonObject userQueryObject = userQueryElement.getAsJsonObject();
String userRef = userQueryObject.get("_ref").toString();
// Get reference to Workspace of interest
QueryRequest workspaceRequest = new QueryRequest("Workspace");
workspaceRequest.setFetch(new Fetch("Name", "Owner", "Projects"));
workspaceRequest.setQueryFilter(new QueryFilter("Name", "=", myWorkspace));
QueryResponse workspaceQueryResponse = restApi.query(workspaceRequest);
String workspaceRef = workspaceQueryResponse.getResults().get(0).getAsJsonObject().get("_ref").toString();
// Get reference to Project of interest
QueryRequest projectRequest = new QueryRequest("Project");
projectRequest.setFetch(new Fetch("Name", "Owner", "Projects"));
projectRequest.setQueryFilter(new QueryFilter("Name", "=", myProject));
QueryResponse projectQueryResponse = restApi.query(projectRequest);
String projectRef = projectQueryResponse.getResults().get(0).getAsJsonObject().get("_ref").toString();
// Get reference to Tag(s) of interest
QueryRequest tagRequest = new QueryRequest("Tag");
tagRequest.setFetch(new Fetch("Name"));
// Look for Tag named "Alpine"
tagRequest.setQueryFilter(new QueryFilter("Name", "=", tagNameAlpine));
QueryResponse tagQueryResponse = restApi.query(tagRequest);
JsonObject tagAlpineJsonObject = tagQueryResponse.getResults().get(0).getAsJsonObject();
JsonElement tagAlpine = tagQueryResponse.getResults().get(0).getAsJsonObject();
String tagAlpineRef = tagAlpineJsonObject.get("_ref").toString();
// Look for a second Tag named "Montane"
tagRequest.setQueryFilter(new QueryFilter("Name", "=", tagNameMontane));
tagQueryResponse = restApi.query(tagRequest);
JsonObject tagMontaneJsonObject = tagQueryResponse.getResults().get(0).getAsJsonObject();
JsonElement tagMontane = tagQueryResponse.getResults().get(0).getAsJsonObject();
String tagMontaneRef = tagMontaneJsonObject.get("_ref").toString();
// Query for existing Test Case
QueryRequest existTestCaseRequest = new QueryRequest("TestCase");
existTestCaseRequest.setFetch(new Fetch("FormattedID","Name","Tags"));
existTestCaseRequest.setQueryFilter(new QueryFilter("FormattedID", "=", existTestCaseFormattedID));
QueryResponse testCaseQueryResponse = restApi.query(existTestCaseRequest);
JsonObject existTestCaseJsonObject = testCaseQueryResponse.getResults().get(0).getAsJsonObject();
String existTestCaseRef = testCaseQueryResponse.getResults().get(0).getAsJsonObject().get("_ref").toString();
JsonArray existTagsJsonArray = (JsonArray) testCaseQueryResponse.getResults().get(0).getAsJsonObject().get("Tags");
// Update Tags on Existing Test Case
try {
// Add additional Tag to Existing Test Case's Tag Collection
existTagsJsonArray.add(tagMontane);
//Add Tag
System.out.println("\nUpdating Existing Test Case's tags...");
JsonObject updateExistTestCase = new JsonObject();
updateExistTestCase.add("Tags", existTagsJsonArray);
UpdateRequest updateExistTestCaseRequest = new UpdateRequest(existTestCaseRef, updateExistTestCase);
UpdateResponse updateExistTestCaseResponse = restApi.update(updateExistTestCaseRequest);
if (updateExistTestCaseResponse.wasSuccessful()) {
System.out.println("Updated Test Case with new Tags");
} else {
String[] updateExistTestCaseErrors;
updateExistTestCaseErrors = updateExistTestCaseResponse.getErrors();
System.out.println("Error occurred updating Test Case: ");
for (int i=0; i<updateExistTestCaseErrors.length;i++) {
System.out.println(updateExistTestCaseErrors[i]);
}
}
} catch (Exception e) {
System.out.println("Exception occurred while updating Tags on existing Test Case: ");
e.printStackTrace();
}
// Create a New Test Case and Add Tags to it
try {
//Create a Test Case
System.out.println("Creating Test Case...");
JsonObject newTestCase = new JsonObject();
newTestCase.addProperty("Name", "TC0400-1200: SeleniumGroup004");
newTestCase.addProperty("Method", "Automated");
newTestCase.addProperty("Type", "Performance");
newTestCase.addProperty("Workspace", workspaceRef);
newTestCase.addProperty("Project", projectRef);
newTestCase.addProperty("Owner", userRef);
CreateRequest createRequest = new CreateRequest("testcase", newTestCase);
CreateResponse createResponse = restApi.create(createRequest);
if (createResponse.wasSuccessful()) {
System.out.println(String.format("Created %s", createResponse.getObject().get("_ref").getAsString()));
//Read Test Case
String newTestCaseRef = Ref.getRelativeRef(createResponse.getObject().get("_ref").getAsString());
System.out.println(String.format("\nReading Test Case %s...", newTestCaseRef));
GetRequest getRequest = new GetRequest(newTestCaseRef);
getRequest.setFetch(new Fetch("FormattedID", "Name", "Tags"));
GetResponse getResponse = restApi.get(getRequest);
JsonObject obj = getResponse.getObject();
System.out.println(String.format("Read Test Case. FormattedID = %s, Name = %s",
obj.get("FormattedID").getAsString(), obj.get("Name").getAsString()));
// JsonArray for Tags collection on Test Case
JsonArray newTagsJsonArray = new JsonArray();
newTagsJsonArray.add(tagAlpine);
newTagsJsonArray.add(tagMontane);
//Add Tag
System.out.println("\nUpdating Test Case tags...");
JsonObject updatedTestCase = new JsonObject();
updatedTestCase.add("Tags", newTagsJsonArray);
UpdateRequest updateRequest = new UpdateRequest(newTestCaseRef, updatedTestCase);
UpdateResponse updateResponse = restApi.update(updateRequest);
if (updateResponse.wasSuccessful()) {
System.out.println("Updated Test Case with new Tags");
} else {
String[] updateErrors;
updateErrors = updateResponse.getErrors();
System.out.println("Error occurred updating Test Case: ");
for (int i=0; i<updateErrors.length;i++) {
System.out.println(updateErrors[i]);
}
}
} else {
String[] createErrors;
createErrors = createResponse.getErrors();
System.out.println("Error occurred creating Test Case: ");
for (int i=0; i<createErrors.length;i++) {
System.out.println(createErrors[i]);
}
}
} finally {
//Release all resources
restApi.close();
}
}
}
关于java - 如何使用 Rally 的 JAVA API 将标签添加到 Rally 中的测试用例?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12655357/
过去,我将 Rally 服务器上存在的一些图像合并到我的应用程序中——例如,我制作了一个更通用的“选择器”菜单,显示复选框,当然,复选框和框依赖于图像。 当然,当 SDK 版本更改时,我希望必须检查我
我有一个用户在集会中创建了一堆“故事”,而实际上它们应该是任务。有没有办法在 Rally 中将用户故事转换为任务?我已经搜索过 Rally 的帮助站点,但它似乎没有提供答案。 最佳答案 在 Rally
我需要修改默认的 Rally 看板应用程序以仅显示选定的迭代。我放入查询迭代下拉列表,然后添加: //基于迭代下拉列表构建查询 cardboardConfig.query = dropdownIter
如何在 Rally 中添加新的用户故事状态?即定义、完成、接受、自定义状态 最佳答案 拉力赛知识库文章“修改计划状态”: http://www.rallydev.com/help/modifying-
请谁能帮我解决这个问题,以下语法将如何出现在 Rally SDK 2 中或者您可以向我推荐一些相关文档,因为我找不到任何文档。 rally.function_name = function (rall
这似乎是一个非常基本的问题,但我在 Rally 中找不到它,所以就在这里,我在哪里可以找到拉力赛中的工作区和项目 OID? 最佳答案 为了其他可能想知道答案的用户的利益,这里有几种查找 OID 的方法
Rally 显然具有一些缺陷跟踪功能。 我的问题是;它足够好/足够灵活以作为组织的唯一缺陷跟踪器吗?或者在其他工具(如 Bugzilla 或 JIRA)中进行一般缺陷跟踪是否更常见? (可能使用 Ra
我创建了一个动态创建网格的应用程序,并允许用户通过“数字字段”编辑器对网格列之一进行更改。在调试环境中一切正常,但是当我尝试编辑 Rally 环境中的字段之一时,它会使应用程序崩溃。从它的外观来看,包
我正在尝试用 rally 组件做基本的 CSS。目前我正在努力让 xtype 'rallybutton' 与 xtype 'rallyiterationcombobox' 内联。我使用的 CSS 文件
鉴于表达式 {WorkProduct: {$in:[0001,0002,0003,...]} 我可以查询的项目数量有限制吗? 最佳答案 我们的 API 没有强制限制,但我们发送到底层引擎的整体查询必须
我想编写包含 Rally 问题(测试用例、缺陷等)链接的网页。我希望能够生成一个带有 FormattedID 的 URL。这可能吗?还是我真的需要objectID?例如: http://rally1.
如何查询我们所有可用项目的 Rally 实例? REST 调用的输出 https://rally1.rallydev.com/slm/webservice/1.29/subscription.js?f
我是 Rally API 的新手,只是在使用 Rally.RestApi 库创建任务时遇到了一些问题。我需要创建一个任务(使用 .NET)并将其与用户故事相关联(其中用户故事属于某个迭代)。 我是否必
我正在尝试创建一个应用程序,它将显示当前项目中的所有测试集及其通过/失败总数的状态。我面临的问题(顺便说一句,昨天刚开始学习 ExtJS 和 Rally SDK): - 我需要了解如何使用当前选择的项
我在外部开发时无法使用Rally.environment.getContext()。我需要在应用程序启动之前获取 ProjectOID 和 UserOID,因此我无法使用 app.getContext
我试图弄清楚如何通过 Cucumber 自动化脚本自动更新 Rally 中测试用例的测试用例结果。我希望能够运行我的测试脚本,然后该脚本将自动将 Rally 中的测试用例结果更新为“通过”或“失败”。
我们是一家使用 C#、Team Foundation Server 和 Rally 作为我们主要项目跟踪的商店。 我们想使用 Rally Item ChangeSets 来遵循 TFS Changes
我正在使用 Rally REST API 将来自 Rally 的用户故事数据集成到另一个应用程序中。我从 Rally 检索用户故事数据没有问题,但是,我想为其他应用程序的用户提供一个超链接,以便单击以
QueryRequest allreleases = new QueryRequest("release"); allreleases.setQueryFilter(new QueryFilt
我正在尝试使用 java Rally REST API 将图像文件附加到 Rally 中的测试结果(失败的屏幕截图)。图像文件附加到测试用例本身,但不附加到测试结果。试图提供 testCaseResu
我是一名优秀的程序员,十分优秀!