创建一个全局变量并将其用于seleniun的每个测试中

时间:2018-09-25 15:35:06

标签: java selenium testing ui-automation testrail

我正在尝试为testrail中的每个测试设置版本号。

当前,我的测试将测试结果发送回Testrail。 因此,在测试之前,我想使用Scanner询问用户版本号,然后他们在每个测试中输入并使用该字符串,但是我不知道如何创建一个先运行然后将字符串添加到的类。每次测试。

我只是一个质量检查人员,所以我的Java知识不好。

以下是im用于添加版本ID的方法。可以使用getter和setter方法吗?

public static void addResultForTestCase(String testCaseId, int status,
                                        String error) {

    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.");
    data.put("version", String version);

    client.sendPost("add_result_for_case/"+testRunId+"/"+testCaseId+"", data);

}

0 个答案:

没有答案
相关问题