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

[API] update_plan_entry throws error


#1

I am using .Net library at https://github.com/gurock/testrail-api/archive/master.zip.

API doco -

POST update_plan_entry/:plan_id/:entry_id
{
name: string,
assignedto_id: int,
include_all: bool,
case_ids: array
}

My request -
POST update_plan_entry/13/23
{
include_all: false,
case_ids: [9, 171]
}

All ids are correct and proper for the request.

The response -

{“TestRail API returned HTTP 400 (“Field :entry_id is not a valid test plan entry.”)”}


#2

Hello Martin,

Thanks for your posting. The entry_id is a UUID and uses the following format:

The entries are returned as part of the get_plan API call (or add_plan_entry) and each entry can have one or multiple test runs.

I hope this helps!

Regards,
Tobias


#3

Hi Tobias,

This is very confusing. The UI does not seem to allow for the addition of these mysterious entries; it only allows “Add Test Suite”, which can then be filtered and ends up behaving like a run (when I save the Test Plan and click into the filtered Test Suite that I just added, I am taken to the route /runs/view/{run_id}).

Is it something to do with the way my project is configured (I am using a single repository with baseline support)?

Thanks
Martin


#4

Hello Martin,

Thanks for your reply. A test plan entry is represented by a test suite “block” on the test plan form (after you added a test suite). An entry can contain multiple test runs in case you use configurations and that’s the reason why we differentiate between test plan entries and test runs. If you don’t use configurations, a test plan entry contains a single test run only.

I would also recommend reviewing your training video on test plans and configurations:

http://www.gurock.com/testrail/videos/test-plans-configurations/

Regards,
Tobias


#5

Hi Tobias,

How do you get the entry_id of a test run in a test plan? I am doing this initially to create the run (that is adding a plan entry):

     JSONObject obj_add = (JSONObject) client.sendPost(String.format(String.valueOf(uri.ADD_PlAN_ENTRY), 
getTestPlanId()), map);
      JSONArray arr = (JSONArray) obj_add.get("runs");
      for (int i = 0; i < arr.size(); i++) {
        	JSONObject jo = (JSONObject) arr.get(i);
        	testRunId = jo.get("id").toString();
     }

and getting the test run id. At this point, TestRail must have automatically created entry id for my run. I need entry_id because I want to use that later while I handle rerunning of my tests. In order to make a call to update_plan_entry via:

JSONObject obj = (JSONObject) client.sendPost(String.format(String.valueOf(uri.UPDATE_PLAN_ENTRY), getTestPlanId()),.....(2nd param) map);

I need that 2nd param as entry id for the run that I created above (in my snippet).

Thanks in advance,

Pratik


#6

Hi Pratik,

Thanks for your posting. The entry IDs is returned as part of the add_plan/add_plan_entry response, either as part of the entry objects (id attribute) or the actual runs (entry_id):

http://docs.gurock.com/testrail-api2/reference-plans#get_plan

(see Response content)

I hope this helps!

Cheers,
Tobias