Reputation: 453
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.
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();
Any help would be appreciated!
Upvotes: 0
Views: 427
Reputation: 453
Thank you https://stackoverflow.com/users/1431647/alexander-todorov
full example:
//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
Upvotes: 0
Reputation: 2245
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?
As you have already seen it is.
Im able to create connection and login, but there are no familiar methods to update test execution for specific test case.
See this method: https://github.com/kiwitcms/junit-plugin/blob/master/src/main/java/org/kiwitcms/java/api/RpcClient.java#L243 First parameter is the TE ID, the second one is a status ID.
I cannot get this ExecutionId based on CaseID
You need TestExecution.filter() to filter by runId and caseId: https://github.com/kiwitcms/junit-plugin/blob/master/src/main/java/org/kiwitcms/java/api/RpcClient.java#L228
Also see https://kiwitcms.readthedocs.io/en/latest/modules/tcms.rpc.api.html#module-tcms.rpc.api for information what parameters are accepted by the API and how to make queries.
Please be a good open source citizen and consider contributing your Selenium glue code at https://github.com/kiwitcms/api-scripts to help others who may be interested.
Update:
TestCase[] testCases = kiwi.getRunIdTestCases(2);
The raw JSON returned by the underlying TestRun.get_cases() API method contains both status
and execution_id
fields but the Java serializer code in the junit-plugin library ignores them b/c they aren't part of the TestCase model, see model/TestCase.java
.
Upvotes: 2
Reputation: 453
I'm very close now:
there are method for updating Test Execution:
kiwi.updateTestExecution(ExecutionId,status);
but I cannot get this ExecutionId based on CaseID
if i run:
TestCase[] testCases = kiwi.getRunIdTestCases(2);
I get:
there are no Execution ID
Upvotes: 0