您可以关注来自 Testrail 的 API 文档:
http://docs.gurock.com/testrail-api2/start
并且必须创建自己的 RESTful 服务,该服务将依赖于 Testrail API。
我已经使用他们的文档创建了与 Testrail 的连接,并为每个操作添加了 JSON(类)模型。
例如。获取测试用例
要求:
GET index.php?/api/v2/get_test/:test_id
response:
回复:
{
"assignedto_id": 1,
"case_id": 1,
"custom_expected": "..",
"custom_preconds": "..",
"custom_steps_separated": [
{
"content": "Step 1",
"expected": "Expected Result 1"
},
{
"content": "Step 2",
"expected": "Expected Result 2"
}
],
"estimate": "1m 5s",
"estimate_forecast": null,
"id": 100,
"priority_id": 2,
"run_id": 1,
"status_id": 5,
"title": "Verify line spacing on multi-page document",
"type_id": 4
}
json模型:
public class Test {
private static final String CUSTOM_FIELD_KEY_PREFIX = "custom_";
private int id;
private int caseId;
private Integer assignedtoId;
private String title;
private int statusId;
private int typeId;
private int priorityId;
private Integer milestoneId;
private Integer runId;
private String refs;
private String estimate;
private String estimateForecast;
private Map<String, Object> customFields;
public Map<String, Object> getCustomFields() {
return customFields;
}
但可能最简单的方法是直接发送请求并解析响应并围绕它创建一个小服务。