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

API Bug: update_plan_entry


#1

Hi! I seemed to have found a bug in the TestRail API related to the call update_plan_entry For the most part this call is working fine - other times it gives me the 400 error entry_id is not a valid test plan entry. However I’ve verified this is not true by using the API call get_plan to verify that the entryID I supplied is valid.

Here is an example:

Received a 400 on this request: https://testrail.internal.justin.tv/index.php?/api/v2/update_plan_entry/4612185/30a235c1-8e0c-4b8d-9b63-e33a28e01072 Error got status code 400 and message {"error":"Field :entry_id is not a valid test plan entry."}

Response from get_plan call:
{ id: 4612185,
name: ‘improve-testrail-grid-73’,
description: null,
milestone_id: 5774,
assignedto_id: null,
is_completed: false,
completed_on: null,
passed_count: 35,
blocked_count: 0,
untested_count: 477,
retest_count: 0,
failed_count: 0,
project_id: 1,
created_on: 1528753992,
created_by: 4,
url: ‘http://testrailurl/index.php?/plans/view/4612185’,
entries:
[ { id: ‘549553d2-a192-466a-946b-3d5fc874a711’,
suite_id: 723025,
name: ‘Authed Ad Layout Test’,
runs: [Array] },
{ id: ‘e770e7a2-2343-408e-816b-7a0357d9473d’,
suite_id: 5,
name: ‘Anon Channel Page Test’,
runs: [Array] },
{ id: ‘30a235c1-8e0c-4b8d-9b63-e33a28e01072’,
suite_id: 5,
name: ‘Host Mode Test’, runs: [Array] },
{ id: ‘c9b6acc1-0a75-4487-be4e-c7c8ad889e59’,
suite_id: 5,
name: ‘Authed Invalid Channel Tests’,
runs: [Array] },
{ id: ‘f4786429-d7a3-4008-b21b-e62c5171545d’,
suite_id: 723025,
name: ‘Anon Ad Layout Test’,
runs: [Array] },
{ id: ‘03c85250-1c01-47a4-bdc1-ba7732d3eba1’,
suite_id: 5,
name: ‘Authed Channel Layout Tests’,
runs: [Array] },
{ id: ‘18803b71-0546-4266-ba5f-f220664ef1c9’,
suite_id: 5,
name: ‘Channel Page Clips Test’,
runs: [Array] } ] }

As you can see, the EntryID is listed in the array of entries - what’s strange is that from here I’m still unable to update the ID 30a235c1-8e0c-4b8d-9b63-e33a28e01072, but I am able to use the API to delete the plan entry with the same PlanID and EntryID.

Please let me know if you there’s any more information I can provide to illustrate this issue more clearly. Thanks for your time and hope to get a response soon!


#2

Hi Kashin,

thanks for your posting. Do you always get response code 400 for same entry ID or is it random? If same entry ID always fails, is there anything different/specific in this test run comparing to others that are working?

Also, update_plan_entry API request contains a body. What fields did you add in body when request failed? The following POST fields are supported:

Name Type Description
name string The name of the test run(s)
description string The description of the test run(s) (requires TestRail 5.2 or later)
assignedto_id int The ID of the user the test run(s) should be assigned to
include_all bool True for including all test cases of the test suite and false for a custom case selection (default: true)
case_ids array An array of case IDs for the custom case selection

Regards,
Sabina


#3

Hi Sabina,

It seems random which entry ID I get the 400 error code for. We are currently running continuous integration and the point of the error varies from run to run. There’s nothing specific about this test compared to others that I could see having an effect. I’m passing { case_ids, include_all: false } as the body of the request where case_ids is an array of IDs (I’ve verified they are valid).

I’ve found a workaround by calling delete_plan_entry and then calling add_plan_entry again but I’d like to avoid doing this. Are the 2 calls possibly using different methods for looking up the EntryID?

Thanks,
Kashin