猕猴桃中医 | junit 插件 |无法向 Kiwi 发布测试结果
Kiwi-tcms | junit-plugin | Not able to publish test results to Kiwi
我有用 JAVA 编写的 selenium 自动化测试框架。与 Junit5 和 kiwi 的 junit-plugin 集成。
我正在尝试根据我的自动化测试结果更新 kiwi 上的测试执行。首先,我想知道这是否可行?
我能够创建连接和登录,但没有熟悉的方法来更新特定测试用例的测试执行。
RpcClient kiwi = new RpcClient();
kiwi.login("my_username", "my_password");
//I need here something like
kiwi.updateTestCaseExecution("specific_test_run", "specific_test_case", "test_status");
kiwi.logout();
如有任何帮助,我们将不胜感激!
我现在很接近了:
有更新测试执行的方法:
kiwi.updateTestExecution(ExecutionId,status);
但我无法根据 CaseID
获取此 ExecutionId
如果我运行:
TestCase[] testCases = kiwi.getRunIdTestCases(2);
我得到:
没有执行 ID
I have selenium automation test framework written in JAVA. Integrated
with Junit5 and kiwi's junit-plugin.
Im trying to update test execution on kiwi based on my automated test
result. First, im wondering is that doable?
如您所见。
Im able to create connection and login, but there are no familiar
methods to update test execution for specific test case.
看这个方法:https://github.com/kiwitcms/junit-plugin/blob/master/src/main/java/org/kiwitcms/java/api/RpcClient.java#L243第一个参数是TE ID,第二个是状态ID。
I cannot get this ExecutionId based on CaseID
您需要 TestExecution.filter() 来按 runId 和 caseId 进行过滤:
https://github.com/kiwitcms/junit-plugin/blob/master/src/main/java/org/kiwitcms/java/api/RpcClient.java#L228
另请参阅 https://kiwitcms.readthedocs.io/en/latest/modules/tcms.rpc.api.html#module-tcms.rpc.api 了解 API 接受哪些参数以及如何进行查询的信息。
请成为一名优秀的开源公民,并考虑在 https://github.com/kiwitcms/api-scripts 贡献您的 Selenium 胶水代码,以帮助可能感兴趣的其他人。
更新:
TestCase[] testCases = kiwi.getRunIdTestCases(2);
基础 TestRun.get_cases() API 方法返回的原始 JSON 包含 status
和 execution_id
字段,但 Java junit-plugin 库中的序列化程序代码会忽略它们 b/c 它们不是 TestCase 模型的一部分,请参阅 model/TestCase.java
。
谢谢https://whosebug.com/users/1431647/alexander-todorov
完整示例:
//create client instance
RpcClient kiwi = new RpcClient();
//login
kiwi.login("username", "password");
//every selenium test case should have assigned case id (from kiwi)
int runId = "your_run_id";
//search for execution ID based on case ID and run ID
Map<String, Object> params = new HashMap<>();
params.put("run_id", runId);
params.put("case_id", "your_case_id");
TestExecution tcExec = kiwi.getTestExecution(params);
int tcExecId = tcExec.getTcRunId();
//update execution with results
kiwi.updateTestExecution(tcExecId, 5);
//test statuses
//1 - IDLE
//2 - RUNNING
//3 - PAUSED
//4 - PASSED
//5 - FAILED
//6 - BLOCKED
//7 - ERROR
//8 - WAIVED
我有用 JAVA 编写的 selenium 自动化测试框架。与 Junit5 和 kiwi 的 junit-plugin 集成。
我正在尝试根据我的自动化测试结果更新 kiwi 上的测试执行。首先,我想知道这是否可行?
我能够创建连接和登录,但没有熟悉的方法来更新特定测试用例的测试执行。
RpcClient kiwi = new RpcClient();
kiwi.login("my_username", "my_password");
//I need here something like
kiwi.updateTestCaseExecution("specific_test_run", "specific_test_case", "test_status");
kiwi.logout();
如有任何帮助,我们将不胜感激!
我现在很接近了:
有更新测试执行的方法:
kiwi.updateTestExecution(ExecutionId,status);
但我无法根据 CaseID
获取此 ExecutionId如果我运行:
TestCase[] testCases = kiwi.getRunIdTestCases(2);
我得到:
没有执行 ID
I have selenium automation test framework written in JAVA. Integrated with Junit5 and kiwi's junit-plugin.
Im trying to update test execution on kiwi based on my automated test result. First, im wondering is that doable?
如您所见。
Im able to create connection and login, but there are no familiar methods to update test execution for specific test case.
看这个方法:https://github.com/kiwitcms/junit-plugin/blob/master/src/main/java/org/kiwitcms/java/api/RpcClient.java#L243第一个参数是TE ID,第二个是状态ID。
I cannot get this ExecutionId based on CaseID
您需要 TestExecution.filter() 来按 runId 和 caseId 进行过滤: https://github.com/kiwitcms/junit-plugin/blob/master/src/main/java/org/kiwitcms/java/api/RpcClient.java#L228
另请参阅 https://kiwitcms.readthedocs.io/en/latest/modules/tcms.rpc.api.html#module-tcms.rpc.api 了解 API 接受哪些参数以及如何进行查询的信息。
请成为一名优秀的开源公民,并考虑在 https://github.com/kiwitcms/api-scripts 贡献您的 Selenium 胶水代码,以帮助可能感兴趣的其他人。
更新:
TestCase[] testCases = kiwi.getRunIdTestCases(2);
基础 TestRun.get_cases() API 方法返回的原始 JSON 包含 status
和 execution_id
字段,但 Java junit-plugin 库中的序列化程序代码会忽略它们 b/c 它们不是 TestCase 模型的一部分,请参阅 model/TestCase.java
。
谢谢https://whosebug.com/users/1431647/alexander-todorov
完整示例:
//create client instance
RpcClient kiwi = new RpcClient();
//login
kiwi.login("username", "password");
//every selenium test case should have assigned case id (from kiwi)
int runId = "your_run_id";
//search for execution ID based on case ID and run ID
Map<String, Object> params = new HashMap<>();
params.put("run_id", runId);
params.put("case_id", "your_case_id");
TestExecution tcExec = kiwi.getTestExecution(params);
int tcExecId = tcExec.getTcRunId();
//update execution with results
kiwi.updateTestExecution(tcExecId, 5);
//test statuses
//1 - IDLE
//2 - RUNNING
//3 - PAUSED
//4 - PASSED
//5 - FAILED
//6 - BLOCKED
//7 - ERROR
//8 - WAIVED