Repository navigation
TR-22028: Priority tag mapping for Robot Parser - #468
acuanico-tr-galt wants to merge 4 commits into
Conversation
… tags and cli options
… parser, also updated README guide
| return resolved, "Invalid --priority-tag-mapping entry: level name cannot be empty" | ||
| try: | ||
| resolved[level_key] = int(str(priority_id).strip()) | ||
| except (ValueError, TypeError): |
There was a problem hiding this comment.
resolved is mutated inside this loop. If the first entry succeeds (critical:5 → resolved["critical"] = 5) and a later entry fails (high:not_a_number), the function returns the partially-mutated resolved dict alongside the error. The caller gets back {"critical": 5, "high": 3, ...} — not the clean defaults. The test_entry_without_colon_is_rejected test asserts mapping == DEFAULT_MAPPING, but only works because that test uses a single-entry list. A two-entry test like ["critical:5", "high:not_a_number"] would break that invariant. The fix is simple: return a fresh dict(PriorityTagMappingParser.DEFAULT_MAPPING) instead of the dirty resolved in the error paths inside the second loop.
There was a problem hiding this comment.
Resolved. Both error paths in second loop now return proper dict(PriorityTagMappingParser.DEFAULT_MAPPING) instead of partially mutated resolved dict.
| @click.option( | ||
| "--priority-tag-mapping", | ||
| multiple=True, | ||
| metavar="", |
There was a problem hiding this comment.
With metavar="", running trcli parse_robot --help will show --priority-tag-mapping with no hint of what format to pass. The user has no idea it takes LEVEL:ID. Use metavar="LEVEL:ID" (or metavar="TEXT") to give them a signal.
…bug in data_parsers.py and missing metavar hint
Solution description
Automatically map Robot Framework priority: tags to TestRail priority_id values when importing results via parse_robot. Test tags matching priority:critical, priority:high, priority:medium, or priority:low (case-insensitive) are parsed and converted to the corresponding TestRail priority_id, using a default mapping (critical=4, high=3, medium=2, low=1).
NEW flag: --priority-tag-mapping CLI option (repeatable, level:id format, e.g. --priority-tag-mapping critical:5 --priority-tag-mapping low:1) lets users override or extend the default mapping per-run, without needing to specify every level — unspecified levels keep their defaults, and new custom level names can be added.
Changes
Potential impacts
None.
Steps to test
See updated README: 216 - 259
PR Tasks