Hi,
Adding test cases to a test run via API is almost the same as setting results for a test case in a test run: You create a mapping between test case and test run and also pass in the result.
The below API call uses the add_or_update
operation, so you can basically use it to add a test case or update it’s result within a test run:
curl -L -X POST 'https://app.testiny.io/api/v1/testrun/mapping/bulk/testcase:testrun?op=add_or_update' \
-H 'Content-Type: application/json' \
-H 'X-Api-Key: <API_KEY_VALUE>' \
--data-raw '[{
"ids": { "testcase_id": 1234, "testrun_id": 3 },
"mapped": { "result_status": "PASSED" }
}]'
Please update the API-Key, the test case id + the run id to the respective values. The allowed values for the result status are NOTRUN,PASSED,FAILED,BLOCKED,SKIPPED
as you can see in the API documentation:
If you’re adding/updating test case results from a result file, e.g. from a JUnit XML file, using the Testiny CLI may be easier as explained here:
Hope this helps you get going
Regards,
Alex