Skip to content

add_run with --suite-id fails to find suite in project #332

@cgeisel

Description

@cgeisel

TestRail CLI Version

1.10.1

CLI Environment

Redhat UBI 9, Python 3.12.1

TestRail Version

9.3.2 Default (1002)

TestRail Instance Type

Enterprise Cloud

Current behavior

I'm running this add_run command:

trcli -y --verbose -h https://REDACTED.testrail.com/ --project 'REDACTED' --project-id 29 -u "${TR_USER}" -k "${TR_API_KEY}" add_run -f config.yml --title 'Automated Test Run REDACTED 2025-07-30T18:23:13Z' --run-description 'Run created by cgeisel' --suite-id 89675

The command exits with an error:

TestRail CLI v1.10.1
Copyright 2025 Gurock Software GmbH - www.gurock.com
Parser Results Execution Parameters
> TestRail instance: https://REDACTED.testrail.com/ (user: test-results-uploader@lululemon.com)
> Project: REDACTED
> Run title: Automated Test Run REDACTED 2025-07-30T18:23:13Z
> Suite ID: 89675
> Description: Run created by cgeisel
> Milestone ID: None
> Assigned To ID: None
> Include All: False
> Case IDs: None
> Refs: None
Checking project. 
**** API Call
method: GET
url: https://REDACTED.testrail.com/index.php?/api/v2/get_projects
response status code: 200
response body: {'offset': 0, 'limit': 250, 'size': 250, '_links': {'next': '/api/v2/get_projects&limit=250&offset=250', 'prev': None}, 'projects': [{'id': 1,
... snip ...
}
****

**** API Call
method: GET
url: https://REDACTED.testrail.com/index.php?/api/v2/get_projects&limit=250&offset=250
response status code: 200
response body: {'offset': 250, 'limit': 250, 'size': 23, '_links': {'next': None, 'prev': '/api/v2/get_projects&limit=250&offset=0'}, 'projects': [{'id': 274,
... snip ...
}
****
Done.

**** API Call
method: GET
url: https://REDACTED.testrail.com/index.php?/api/v2/get_suites/29
response status code: 200
response body: {'offset': 0, 'limit': 250, 'size': 250, '_links': {'next': '/api/v2/get_suites/29&limit=250&offset=250', 'prev': None}, 'suites': [{'id': 431,
... snip ...
{'id': 8783, 'name': 'REDACTED', 'description': None, 'project_id': 29, 'is_master': False, 'is_baseline': False, 'is_completed': False, 'completed_on': None, 'url': 'https://lululemon.testrail.com/index.php?/suites/view/8783'}]}
****
Suite with ID '89675' does not exist in TestRail.

I looked into the project and was able to verify that the suite 89675 does exist in the project by using the get_suites API call.

# https://REDACTED.testrail.com/index.php?/api/v2/get_suites/29&offset=750

{
  "offset": 750,
  "limit": 250,
  "size": 92,
  "_links": {
    "next": null,
    "prev": "/api/v2/get_suites/29&offset=500&limit=250"
  },
  "suites": [
... snip ...
    {
      "id": 89675,
      "name": "REDACTED",
      "description": "REDACTED",
      "project_id": 29,
      "is_master": false,
      "is_baseline": false,
      "is_completed": false,
      "completed_on": null,
      "url": "https://REDACTED.testrail.com/index.php?/suites/view/89675"
    },
... snip ...
  ]
}

It appears that the add_run command is only checking the first page of get_suites results to validate the --suite-id argument.

Desired behavior

I would expect that trcli would paginate through get_suites before returning a not found error, though I am not 100% sure that there isn't some other reason it's not finding my suite.

Can you confirm the expected behavior?

More Details

I can provide the full output of the command with all the API calls and responses if that would be helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingQuestionFurther information is requestedReporter FixIssues where the person who raised it is also taking ownership of the fix/pull-request.Sprint PlanningThe ticket is added to the Sprint Planning backlog

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions