【问题标题】:Create a test run in java using testrail api使用 testrail api 在 java 中创建测试运行
【发布时间】:2018-12-20 17:29:42
【问题描述】:

我正在使用 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 );

}

【问题讨论】:

    标签: java selenium testing automated-tests testrail


    【解决方案1】:

    每次都会创建测试运行。你必须每次都创建它,所以你知道你测试了什么。

    所以你的算法应该是:

    1. 创建测试运行(获取一些 id TR123) - 将测试用例分配给测试运行(全部或仅少数,没关系)

    2. 为每个测试用例添加测试结果,

    希望这会有所帮助,

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-02-21
      • 2019-03-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-03
      相关资源
      最近更新 更多