簡體   English   中英

如何使用特定測試用例在 Testrail 中添加新測試運行而不是全部包含?

[英]How to add New Testrun in Testrail with specific testcase instead of include all?

下面的代碼用於在 testrail 中創建一個包含所有選項的新測試運行,其中 select 來自項目的所有測試用例。 如果我只想 select 為我的測試運行一組特定的測試用例,如何添加?

public static void createSuite() throws IOException, APIException {
        //Login to API
        client = new APIClient("https://swtestacademy.testrail.io");
        client.setUser("canberkakduygu@gmail.com");
        client.setPassword("Qwerty_123");
        //Create Test Run
        Map data = new HashMap();
        data.put("include_all",true);
        data.put("name","Test Run "+System.currentTimeMillis());
        JSONObject c = (JSONObject)client.sendPost("add_run/"+PROJECT_ID,data);
        //Extract Test Run Id
        runId = (Long)c.get("id");
    }

參考https://www.gurock.com/testrail/docs/api/reference/runs

為了 select 來自測試套件的自定義測試用例列表,您應該對“include_all”使用 false,然后添加自定義用例 ID 數組。

示例(來自上頁):{ "suite_id": 1, "name": "This is a new test run", "assignedto_id": 5, "refs": "SAN-1, SAN-2", "include_all ": false, "case_ids": [1, 2, 3, 4, 7, 8] }

您可以這樣添加(對我有用):

List list = Arrays.asList("1919581");
Map<String, Serializable> data = new HashMap<>();
data.put("suite_id", 8116);
data.put("name", "Auto add run");
data.put("include_all", false);
data.put("case_ids", (Serializable)list);
JSONObject r = (JSONObject) client.sendPost("add_run/17", data);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM