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

Adding testcases to a testrun in a testplan using the API


#1

Hi,

I am trying to add a testcase to a testrun that is in a testplan using the API.
I used ‘update_plan_entry’ to add the testcase to the plan entry, but it isn’t selected in the existing run yet, so I cannot use ‘add_result_for_case’, because I get an error that the testcase isn’t active.

I cannot use ‘update_run’ either, because I get an error that it isn’t possible for testruns that are in a testplan.

How can I select the testcase in the testrun using the API?


#2

Hi Dirk,

Thanks for your posting. update_plan_entry changes the case selection for the entry (group of runs in a test plan). This also propagates to the runs/configurations in this entry/group but only if they haven’t overridden the case selection themselves (e.g. when adding the test plan or entry via add_plan/add_plan_entry). Do you use a custom case selection per run/configuration?

Cheers,
Tobias


#3

Hi,

Yes I am using a custom case selection per run/configuration. If I put the run on include all, it will select all the cases in the suite, even if they are not selected in the testplan entry.


#4

Hi,

I found the solution.
If I ommit the parameter include_all in the testrun when I create the plan entry, it will inherit the testcases of the plan entry. Thus if I change the selection in the plan entry, the run gets updated automatically.


#5

Hi Dirk,

Yes, in this case the runs use the entry/group-level case selection which can be updated anytime via update_plan_entry. Good to hear it’s working now!

Cheers,
Tobias