Skip to content

Commit 8db1022

Browse files
Merge pull request #424 from gurock/feature/TRCLI-262
TRCLI-262: Added new results command to list and update test results from TestRail
2 parents 6febce7 + 06c9e9b commit 8db1022

5 files changed

Lines changed: 957 additions & 0 deletions

File tree

README.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Supported and loaded modules:
4444
- parse_openapi: OpenAPI YML Files
4545
- add_run: Create a new test run
4646
- labels: Manage labels (add, update, delete, list)
47+
- results: Manage test results (list, update)
4748
- references: Manage references (cases and runs)
4849
```
4950

@@ -92,6 +93,7 @@ Commands:
9293
export_gherkin Export BDD test case from TestRail as .feature file
9394
import_gherkin Upload Gherkin .feature file to TestRail
9495
labels Manage labels in TestRail
96+
results Manage test results in TestRail
9597
parse_cucumber Parse Cucumber JSON results and upload to TestRail
9698
parse_junit Parse JUnit report and upload results to TestRail
9799
parse_openapi Parse OpenAPI spec and create cases in TestRail
@@ -1357,6 +1359,75 @@ tests are run across parallel, independent test nodes, all nodes should report t
13571359
First, use the `add_run` command to create a new run; then, pass the run title and id to each of the test nodes, which
13581360
will be used to upload all results into the same test run.
13591361
1362+
#### Managing Test Results
1363+
1364+
The `results` command provides comprehensive test result management capabilities with two subcommands: `list` and `update`.
1365+
1366+
##### Listing Test Results
1367+
1368+
Retrieve test results from TestRail with flexible filtering options:
1369+
1370+
```bash
1371+
# List results for a specific test
1372+
trcli -c myconfig.yml results list --test-id 1001
1373+
1374+
# List all results for a run
1375+
trcli -c myconfig.ymlresults list --run-id 100
1376+
1377+
# List results for a specific case within a run
1378+
trcli -c myconfig.ymlresults list --case-id 200 --run-id 100
1379+
1380+
# Use pagination
1381+
trcli -c myconfig.yml results list --test-id 1001 --offset 10 --limit 50
1382+
1383+
# Output as JSON for processing
1384+
trcli results list --test-id 1001 --json-output
1385+
1386+
# Show all fields including custom fields in detail
1387+
trcli results list --run-id 100 --show-all-fields
1388+
```
1389+
1390+
**Filtering options:**
1391+
- `--test-id`: Get results for a specific test (mutually exclusive with other filters)
1392+
- `--run-id`: Get results for all tests in a run (can be used alone or with --case-id)
1393+
- `--case-id`: Get results for a specific case (requires --run-id)
1394+
- `--offset`: Pagination offset (default: 0)
1395+
- `--limit`: Pagination limit (default: 250)
1396+
- `--json-output`: Output raw JSON response from API
1397+
- `--show-all-fields`: Show all fields including custom fields in detail
1398+
1399+
##### Updating Test Results
1400+
1401+
Update existing test results after they have been created. Useful for re-run scenarios, adding comments, linking defects, or correcting result data:
1402+
1403+
```bash
1404+
# Update test result status and add comment
1405+
trcli -c myconfig.yml results update --result-id 12345 --status-id 5 --comment "Test failed due to timeout"
1406+
1407+
# Update multiple fields at once
1408+
trcli -c myconfig.yml results update --result-id 12345 \
1409+
--status-id 1 \
1410+
--comment "Passed after retry" \
1411+
--elapsed "45s" \
1412+
--defects "BUG-456" \
1413+
--version "2.1.0"
1414+
1415+
# Update custom fields (JSON format)
1416+
trcli -c myconfig.yml results update --result-id 12345 \
1417+
--custom-fields '{"custom_test_environment": "Production", "custom_browser": "Chrome"}'
1418+
1419+
# Assign result to a user
1420+
trcli -c myconfig.yml results update --result-id 12345 --assignedto-id 7 --comment "Needs investigation"
1421+
```
1422+
1423+
**Status IDs:** 1=Passed, 2=Blocked, 3=Untested, 4=Retest, 5=Failed
1424+
1425+
For complete documentation:
1426+
```bash
1427+
trcli results list --help
1428+
trcli results update --help
1429+
```
1430+
13601431
#### Labels Management
13611432
13621433
The TestRail CLI provides comprehensive label management capabilities using the `labels` command. Labels help categorize and organize your test management assets efficiently, making it easier to filter and manage test cases, runs, and projects.

0 commit comments

Comments
 (0)