Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
290 changes: 194 additions & 96 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ Commands:
statuses Manage test statuses in TestRail
casefields List case fields in TestRail
resultfields List result fields in TestRail
priorities List test case priorities in TestRail
casetypes List test case types in TestRail
users Query users in TestRail
update Update TRCLI to the latest version from PyPI.
```

Expand Down Expand Up @@ -2394,157 +2397,252 @@ Case Status ID: 2
Case status listing completed successfully.
```

### Statuses Command
### Priorities Command

The TestRail CLI provides the `statuses` command for retrieving status information from TestRail. This includes both test result statuses (Passed, Failed, Blocked, etc.) and case statuses (Approved, Draft, etc.). These statuses are crucial for mapping test results correctly and managing test case workflows.
The TestRail CLI provides the `priorities` command for retrieving all available test case priorities from TestRail. This command helps you understand the priority levels configured in your TestRail instance, including their IDs, names, short names, display order, and which priority is set as the default.

#### Statuses Command Overview
#### Reference

The `statuses` command supports two subcommands:
```shell
$ trcli priorities --help

| Subcommand | Purpose | API Endpoint |
|------------|---------|--------------|
| `all` | List all test result statuses | Retrieve available test result statuses (Passed, Failed, Blocked, etc.) |
| `case` | List all case statuses (Enterprise 7.3+) | Retrieve test case statuses (Approved, Draft, etc.) for case workflows |
Usage: trcli priorities [OPTIONS] COMMAND [ARGS]...
Manage test case priorities in TestRail

Options:
--help Show this message and exit.

Commands:
list List all test case priorities from TestRail
```

#### Listing Priorities

```shell
# List all priorities
$ trcli priorities list -h https://yourinstance.testrail.io -u user@example.com -p password

# Show all fields including priority order
$ trcli priorities list -c config.yml --show-all-fields

# JSON output
$ trcli priorities list -c config.yml --json-output
```

#### Example Output

```shell
$ trcli priorities list -c config.yml

Priorities List Execution Parameters
> TestRail instance: https://yourinstance.testrail.io (user: your@email.com)
Retrieving priorities...
Found 4 priority level(s).

ID: 1 | Name: 1 - Don't Test | Short: 1 - Don't
ID: 2 | Name: 2 - Low | Short: 2 - Low
ID: 3 | Name: 3 - Medium | Short: 3 - Med
ID: 4 | Name: 4 - Must Test | Short: 4 - Must [DEFAULT]

Priority listing completed successfully.
```

**Note:** The `[DEFAULT]` marker indicates which priority is set as the default for new test cases in TestRail. Priorities are global settings and apply across all projects in your TestRail instance.

### Case Types Command

The TestRail CLI provides the `casetypes` command for retrieving all available test case types from TestRail. This command helps you understand the different case type classifications configured in your TestRail instance, such as Automated, Functionality, Performance, and others, including which type is set as the default.

#### Reference

```shell
$ trcli statuses --help
$ trcli casetypes --help

Usage: trcli statuses [OPTIONS] COMMAND [ARGS]...
Manage test statuses in TestRail
Usage: trcli casetypes [OPTIONS] COMMAND [ARGS]...
Manage test case types in TestRail

Options:
--help Show this message and exit.

Commands:
all List all test result statuses from TestRail
case List all case statuses from TestRail (Enterprise 7.3+)
list List all test case types from TestRail
```

##### Listing Test Result Statuses
#### Listing Case Types

List all test result statuses available for a project:
```shell
# List all case types
$ trcli -h https://yourinstance.testrail.io -u user@example.com -p password casetypes list

# With config file
$ trcli casetypes list -c config.yml

# JSON output
$ trcli casetypes list -c config.yml --json-output
```

#### Example Output

```shell
# List all test result statuses (using config file)
$ trcli -c config.yml statuses all
$ trcli casetypes list -c config.yml

# List all statuses with all parameters
$ trcli statuses all \
--host https://yourinstance.testrail.io \
--username <your_username> \
--password <your_password> \
--project "Your Project"
Case Types List Execution Parameters
> TestRail instance: https://yourinstance.testrail.io (user: your@email.com)
Retrieving case types...
Found 4 case type(s).

# Show all fields including color values
$ trcli -c config.yml statuses all --show-all-fields
ID: 1 | Name: Automated
ID: 2 | Name: Functionality
ID: 3 | Name: Performance
ID: 6 | Name: Other [DEFAULT]

# JSON output for integration with other tools
$ trcli -c config.yml statuses all --json-output | jq '.[].name'
Case type listing completed successfully.
```

**Example Output:**
**Note:** The `[DEFAULT]` marker indicates which case type is set as the default for new test cases in TestRail. Case types are global settings and apply across all projects in your TestRail instance.

### Users Command

The TestRail CLI provides the `users` command for retrieving user information from TestRail. This command supports getting individual users by ID or email, retrieving the current authenticated user, and listing all users or users with access to a specific project.

#### Reference

```shell
$ trcli -c config.yml statuses all
$ trcli users --help

Statuses List (Test Result Statuses) Execution Parameters
> TestRail instance: https://yourinstance.testrail.io (user: test@example.com)
> Project: Your Project
Usage: trcli users [OPTIONS] COMMAND [ARGS]...
Manage users in TestRail

Retrieving test result statuses for project ID 1...
Found 5 test result status(es):
Options:
--help Show this message and exit.

Status ID: 1
Name: passed
Label: Passed
System Status: Yes
Is Untested: No
Is Final: Yes
Commands:
get Get a specific user from TestRail
list List all users from TestRail
```

Status ID: 2
Name: blocked
Label: Blocked
System Status: Yes
Is Untested: No
Is Final: No
#### Getting a Specific User

Status ID: 3
Name: untested
Label: Untested
System Status: Yes
Is Untested: Yes
Is Final: No
The `get` subcommand retrieves information about a single user using one of three mutually exclusive options:

Status ID: 4
Name: retest
Label: Retest
System Status: Yes
Is Untested: No
Is Final: No
```shell
# Get the current authenticated user
$ trcli -c config.yml users get --current

Status ID: 5
Name: failed
Label: Failed
System Status: Yes
Is Untested: No
Is Final: Yes
# Get user by ID
$ trcli -c config.yml users get --user-id 5

# Get user by email
$ trcli -c config.yml users get --email john.doe@example.com

Status listing completed successfully.
# Show all fields including admin status and enterprise fields
$ trcli -c config.yml users get --user-id 1 --show-all-fields

# JSON output
$ trcli -c config.yml users get --current --json-output
```

##### Listing Case Statuses
#### Listing Users

List all case statuses (requires TestRail Enterprise 7.3+):
The `list` subcommand retrieves multiple users. Without `--project-id`, it lists all users (requires administrator privileges). With `--project-id`, it lists only users with access to that specific project.

```shell
# List all case statuses (using config file)
$ trcli -c config.yml statuses case
# List all users (admin only)
$ trcli -c config.yml users list

# List case statuses with all parameters
$ trcli statuses case \
--host https://yourinstance.testrail.io \
--username <your_username> \
--password <your_password> \
--project "Your Project"
# List users for a specific project
$ trcli -c config.yml users list --project-id 5

# Show all fields including abbreviations
$ trcli -c config.yml statuses case --show-all-fields
# Show all fields for each user
$ trcli -c config.yml users list --project-id 3 --show-all-fields

# JSON output for integration
$ trcli -c config.yml statuses case --json-output | jq '.[].name'
# JSON output
$ trcli -c config.yml users list --json-output
```

**Example Output:**
**Note:**
- The `get` subcommand requires one of `--current`, `--user-id`, or `--email` (mutually exclusive)
- Listing all users without `--project-id` requires administrator privileges (TestRail 6.6+)
- When using `--project-id`, only users with explicit project access are returned (inactive users and users without project access are excluded)
- Enterprise-specific fields (SSO, assigned projects) are only available in TestRail Enterprise
- The `--show-all-fields` option displays additional information including admin status, groups, MFA requirements, and enterprise fields

### Projects Command

The `projects` command provides functionality to query and retrieve project information from TestRail. This command allows you to get details about specific projects or list all projects in your TestRail instance.

The `projects` command supports two subcommands:
- **get**: Retrieve detailed information about a specific project by ID
- **list**: List all projects or filter by completion status with pagination support

#### Getting a Specific Project

The `get` subcommand retrieves detailed information about a single project using its project ID.

```shell
$ trcli -c config.yml statuses case
# Get a specific project by ID
$ trcli -c config.yml projects get --project-id 1

Statuses List (Case Statuses) Execution Parameters
> TestRail instance: https://yourinstance.testrail.io (user: test@example.com)
> Project: Your Project
# Get project with all fields (includes users, groups, announcement)
$ trcli -c config.yml projects get --project-id 1 --show-all-fields

Retrieving case statuses...
Note: This command requires TestRail Enterprise 7.3 or later.
Found 2 case status(es):
# JSON output
$ trcli -c config.yml projects get --project-id 1 --json-output
```

Case Status ID: 1
Name: Approved
Is Default: No
Is Approved: Yes
#### Listing Projects

Case Status ID: 2
Name: Draft
Is Default: Yes
Is Approved: No
The `list` subcommand retrieves multiple projects. You can list all projects or filter by completion status, and use pagination to manage large numbers of projects.

```shell
# List all projects
$ trcli -c config.yml projects list

# List only active projects
$ trcli -c config.yml projects list --is-completed 0

Case status listing completed successfully.
# List only completed projects
$ trcli -c config.yml projects list --is-completed 1

# List with pagination
$ trcli -c config.yml projects list --limit 10 --offset 0

# Show all fields for each project
$ trcli -c config.yml projects list --show-all-fields

# JSON output
$ trcli -c config.yml projects list --json-output
```

**Note:**
- The `--is-completed` filter accepts 0 for active projects or 1 for completed projects
- Pagination parameters `--limit` and `--offset` allow you to retrieve projects in manageable batches
- The `--show-all-fields` option displays additional information including announcement, users, groups, and default role

### Templates Command

The `templates` command provides functionality to query available templates (field layouts) for test cases in a TestRail project. Templates define which fields are available when creating or editing test cases, such as "Test Case (Text)", "Test Case (Steps)", "Exploratory Session", "Behaviour Driven Development", or "AI Evaluation".

The `templates` command supports one subcommand:
- **list**: List all templates available for a specific project

#### Listing Templates

The `list` subcommand retrieves all templates (field layouts) for a specific project.

```shell
# List all templates for a project
$ trcli -c config.yml templates list --project-id 1

# JSON output
$ trcli -c config.yml templates list --project-id 1 --json-output
```

**Note:**
- The `--project-id` parameter is required and must be a valid project ID (x>=1)
- Each template has a unique ID, name, and indicates whether it's the default template for the project
- Templates control which fields are available when creating test cases

### Case Fields Command

The TestRail CLI provides the `casefields` command for retrieving all available test case custom fields from TestRail. This command helps you understand what custom fields are available for test cases, their types, configurations, and which projects they apply to.
Expand Down
Loading
Loading