PractiTest Discussion Forum

Hi, I am writing a automation script to create a run based on an existing instance

Hi, I am writing a automation script to create a run based on an existing instance. However, after creating the run, there are no test steps imported. Is there any way to keep the existing test steps of the instance?

Hi,

Please refer to this section in order to create a run.

Kindly note that you can push your steps within a script by using parameter - data/steps/data* (an array of steps override the exit code).

Please see a cURL example below:

curl -H “Content-Type:application/json”
-u YOUR_EMAIL:YOUR_TOKEN
-X POST https://api.practitest.com/api/v2/projects/4566/runs.json
-d ‘{“data”: {“type”: “instances”, “attributes”: {“instance-id”: 98142}, “steps”: {“data”: [{“name”: “step one”, “expected-results”: “result”, “status”: “FAILED”}, {“name”: “step two”, “expected-results”: “result2”, “status”: “PASSED”}] }}}’

In general when you create a run via API, you don’t have to specify steps. You can just update us with passed or failed, regardless of the steps that the Test has in the Test Library.
The idea is that you don’t want to maintain your steps in both PT and in your automated script. But, if you want, you can just tell PT (via the API), what steps you just ran, as specified above.

Hope this helps.