java - 使用 testrail api 在 java 中创建测试运行
问题描述
我正在使用 java 来更新 testrail 中的测试用例。但是我遇到了测试运行 ID 的问题。我不想每次创建新运行时都更新,我想在 java 上创建一个运行并为每个测试用例使用 id。有没有办法做到这一点?另外,我如何去 testrail 中的不同部分等?. 这是我用来更新测试用例的代码。
public class close_how_to_play extends ConditionsWebDriverFactory{
public static String TEST_RUN_ID = "1741";
public static String TESTRAIL_USERNAME = "testgame@game.com";
public static String TESTRAIL_PASSWORD = "Password1";
public static String RAILS_ENGINE_URL = "https://testgame.testrail.com/";
public static final int TEST_CASE_PASSED_STATUS = 1;
public static final int TEST_CASE_FAILED_STATUS = 5;
@org.testng.annotations.Test
public void how_to_play() throws IOException, APIException {
Header header = new Header();
header.select_how_to_play();
HowToPlay howtoplay = new HowToPlay();
howtoplay.got_how_to_play();
addResultForTestCase("17107",TEST_CASE_PASSED_STATUS," ");
}
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);
Map data = new HashMap();
data.put("status_id", status);
data.put("comment", "Test Executed - Status updated automatically from Selenium test automation.");
client.sendPost("add_result_for_case/"+testRunId+"/"+testCaseId+"",data );
}
解决方案
推荐阅读
- reactjs - 动态建表
- spring-boot - 为 Spring Boot 应用程序创建自定义会话 cookie
- docker - 是否可以像执行到 docker 容器或在 pod 内运行的容器一样执行到 K8s pod?
- ansible - Ansible:如何通过连接“。”来构造 FQDN 的变量。在变量“名称”和变量“域”之间
- python - Marshmallow - 将 None 字符串变为空字符串
- php - 如何在获取后根据其行向数据库插入值?
- powerbi - 如何实现 RLS 但仍能将其与总值进行比较
- c# - LINQ 中的强制类型转换 .include 表达式 C# - ICollection 到 IEnumerable
- java - 无法运行“javac -version”确保您安装了 JDK 版本 8
- reactjs - Nodejs- Req.body undefined in put with express