Replies: 1 comment
-
|
Hi @Paprikh7 Thank you for your inquiry and apologies for the late response. Short answer: No, TRCLI cannot currently match test cases by custom field values like automation_id. The --case-matcher property option requires a property named test_id containing TestRail case IDs (like C88396), not custom field names. As a workaround, You can try to create a preprocessing script that queries the TestRail API to fetch all cases in your target suite (get_cases/304), builds a mapping of automation_id → case_id for the current release, then transforms your JUnit XML to inject the correct test_id properties before running TRCLI. Alternatively, if your workflow allows, consider using TRCLI's dynamic case creation mode (--suite-mode 3 without case matching) where cases are created once with stable custom_automation_id values and then matched by test name in subsequent runs, eliminating the need to track changing case IDs across release suites. As a last resort, you could restructure your TestRail workflow to avoid duplicating entire suites per release, instead using milestones/versions to track releases while maintaining stable case IDs. Thank you. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I would like to ask if it's possible to match automated tests (JUnit) with existing test cases in TestRail.
Setup
In TestRail, I created a custom field named automation_id (type: text).
Then I added the following to my JUnit XML report:
<property name="automation_id" value="C88396"/>I tried to import the results using this command:
trcli -n
--host 'https://host.testrail.io'
--project 'project'
--username 'name@company.com'
--key 'APIKEY'
parse_junit
--file '/home/users/Documents/repo/test/report/results.xml'
--suite-id 304
--run-id 777
--case-matcher property
Result
Parsing JUnit report.
Processed 1 test cases in section apps/applicants.teardown.ts.
Processed 2 test cases in section config/login.setup.ts.
Processed 1 test cases in section apps/applicants/data-transfer/single-applicant-export-and-import.spec.ts.
Checking project. Done.
Found 4 test cases without case ID in the report file.
Updating test run. Test run: https://host.testrail.io/index.php?/runs/view/777
Adding results: 0/0, Done.
No attachments found to upload.
Issue
The problem is that we create new test suites for each release, which duplicates the existing cases into new IDs.
This means I would need to maintain multiple IDs in each test name, which isn’t very efficient.
Question
Is there a way to link JUnit tests with TestRail test cases in a more persistent way — for example, by matching them via the custom automation_id field instead of having to update case IDs for each release?
Beta Was this translation helpful? Give feedback.
All reactions