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

Test Rail :API call to create a Test Plan by including/excluding test case based on title


I want to create a Test Plan by including test cases from the section based on the test case Title.
For example : I have test cases that are still not implemented. So the title has the suffix ->TBD.
So when i create the plan, i want to exclude such test cases.
How can i achieve this with API call?

@sas I think you should be able to do the following:

  1. get an array of all cases from a given project/test suite (get_cases),
  2. filter it by the test case title,
  3. map to an array of test case ids,
  4. pass the list of ids into corresponding add_plan or add_run API

Btw, think about adding custom parameter with “TBD” value or simply a priority field, instead of having “TBD” in the test case title. IMO, it’ll be easier to filter out tests like this through either API or TestRail UI.

@dmytro : I did implement the 1st option that you mentioned : Getting array of test cases and filtering by title .
I have a follow up question:

Passing the list of ids to the add_plan API is not working for me. Reason being all these test cases in the suite below to different sections. It would create a plan with only few test cases belonging to one of the suite . How can i solve this problem?

To be honest, I’ve never worked with Test Plans (I usually create Test Runs for a project and work from there) so this is just my thoughts how I’d try to implement this :slight_smile:
I had a quick look into Plans APIs ( There’s add_plan_entry which takes suite_id ant case_ids array. I guess this is how specific test cases can be added as a part of a Test Suite to a Test Plan.
Actually, looks like you can pass Entry object into add_plan call.

But again, I can’t see your project structure and not sure this will work for your case.