Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.
 

Add results for steps in tests by API

#1

Hello,
I use TestRail API in my autotests. There is the problem when I use several asserts in one test each assert adds result for a test and summary result of the test displays result of a last assert only. There are steps in tests and we can add results for each steps manually, but as well as I got from API documentation there is no way to add results for each step by API. So my question - are you going to add that functionality to API in future or maybe I can solve this problem other way?

#2

Hi Grigoriy,

Thanks for your posting! The API also fully supports steps and you can find an example here:

http://docs.gurock.com/testrail-api2/reference-results#add_result

(see “Request example” for add_result)

Separated steps would usually be used for manual/functional tests and not so much with automated tests but the API supports this and you can follow the example in the documentation to learn more about the expected format and syntax. Happy to help in case anything is unclear or if you have any questions.

Cheers,
Tobias

#3

Good day,

I have had similar issue and have been unable to update specific steps. Is the “custom_step_results” POST still accurate?

Thanks

De Jager

#4

I have same question. “custom_step_results” still works?

#5

Hi Dan,

Thanks for the post! Yes, you can still construct results for individual steps as outlined in our documentation above.

When submitting step results, you would submit data for all steps together, as it would not be directly possible to directly submit results to a specific step. Each step would require at least a ‘status_id’ field, however this can be set to ‘status_id’ : 3, which would mark the step as untested. You may find this example helpful:

{
	"status_id": 5,
	"custom_step_results": [
		{
			"content": "Step 1",
			"expected": "Expected Result 1",
			"actual": "Actual Result 1",
			"status_id": 1
		},
		{
			"content": "Step 2",
			"expected": "Expected Result 2",
			"actual": "Actual Result 2",
			"status_id": 5
		},
		{
			"content": "Step 3",
			"expected": "Expected Result 3",
			"status_id": 3
		},
		{
			"content": "Step 4",
			"expected": "Expected Result 4",
			"status_id": 3
		}
	]
}

Hope this helps,
Jon