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

Changing Selected Cases with Automation


Im currently running Selenium with TestRail and I am sending all my results to a test plan (add_results_for_cases). I noticed that every time I create a new test run inside the test plan it includes all of the test cases Ive created in Testrail. Is there a way to automatically set it up so that it only includes selected cases?

Hi @lawcrens,

are you talking about creating the test run via UI or API?
Using the UI you can select the cases as shown in your screenshot, just left of your rectangle.
The API offer a way to pass the cases you want to use if you set include_all to false.

So, I’m not about the challenge…

Using API. Where do I add include_all?

It would be in the payload to the API - likely as a parameter. They have documentation on the API calls/parameters that can be looked at.

Out team was working through this the other day.

This is the request body that worked for us to create a run with just one test case in it:

	"suite_id": 1,
	"name": "New test run",
	"include_all": false,
	"case_ids": [ 350 ]

Note: the suite_id is not required if your project is in single-suite mode.

1 Like

Thanks for the help. This method using an ArrayList worked for me.