在Java中为Test Rail创建Post Api



我试图创建一个java post请求,以在测试轨道上创建一个测试运行,但它似乎在我的代码中不起作用

public class create_run {
public JSONObject AddTestRunTest() throws IOException, APIException {
JSONObject jsonobject = new JSONObject();
APIClient client = new APIClient("https://stdec.testrail.com/");
client.setUser("fea@sportdec.com");
client.setPassword("Fa1");
Map<String, Object> map = new HashMap<String, Object>();
map.put("suite_id", 829);
map.put("assignedto_id", 1);
map.put("name", "Regression Test");
map.put("include_all", true);
map.put({"17082","17085"});
client.sendPost("index.php?/api/v2/add_run/24", map);
return jsonobject;
}
}

testrail文档在这里,我正在寻找添加运行http://docs.gurock.com/testrail-api2/reference-runs这里的任何帮助如何使它真正发挥作用,都是完成的,但什么都没有发生。我是一名测试人员,但在Java 的这一部分上很吃力

已通过以下方式对该问题进行了排序:

public static String TEST_RUN_ID                = "27";
public static String TESTRAIL_USERNAME          = "xxx@yahoo.com";
public static String TESTRAIL_PASSWORD          = "jdNnNt0OKyNnVA0BW";
public static String RAILS_ENGINE_URL           = "https://axulxharmx.testrail.io/";
public static final int TEST_CASE_PASSED_STATUS = 1;
public static final int TEST_CASE_FAILED_STATUS = 5;

public static void addResultForTestCase(String testCaseId, int status,
String error) throws IOException, APIException {
String testRunId = TEST_RUN_ID;
APIClient client = new APIClient(RAILS_ENGINE_URL);
client.setUser(TESTRAIL_USERNAME);
client.setPassword(TESTRAIL_PASSWORD);

HashMap data = new HashMaps();
data.put("status_id", status);
data.put("comment", "Test Executed- Status updated test automation framework.");
client.sendPost("add_result_for_case/"+testRunId+"/"+testCaseId+"",data );
}

**它在java代码和POSTMAN中运行良好,并将结果推送到我的TestRail实例中。

相关内容

  • 没有找到相关文章

最新更新