allankp / pytest-testrail

pytest plugin for integration with TestRail, for creating testruns and updating results
MIT License
95 stars 125 forks source link

Support ability to provide test plan name substring or regex instead of test plan id #127

Open amygitsthings opened 4 years ago

amygitsthings commented 4 years ago

Is your feature request related to a problem? Please describe. I have tests hooked into my CI/CD pipeline that will publish results to a TestRail test plan I create every milestone. The problem is that every milestone when I close the previous test plan and open a new one, I also have to update my pytest-testrail call to update to the new plan_id. My test plan names all follow the same format, something like "Milestone X Test Plan" It'd be great if I could update my testrail.cfg file to provide something like

[TESTRUN]
plan_regex = Milestone \d+ Test Plan

This would allow my config the flexibility to find the right existing test plan to publish test results to without me having to update an id every milestone.

Describe the solution you'd like Something like if I specify

[TESTRUN]
plan_regex = Milestone \d+ Test Plan

My test results will be published to the first open testplan with a name that matches the plan_regex.

Describe alternatives you've considered I thought about creating a testrail.cfg generator that will first look up the id of the test plan I want and then generate the testrail.cfg file to feed into my pytest call, but I feel like that is overkill and it'd be much better if pytest-testrail supported this ability directly.

Additional context I'll create a pull request shortly with my proposed new config.