rhevm-qe-automation / pytest_jira

py.test plugin to integrate with JIRA
GNU General Public License v2.0
29 stars 25 forks source link

Generate report of tests dependent on Jira #104

Open yoram-s opened 5 years ago

yoram-s commented 5 years ago

HI, I'm looking for a nice way to generate a report for all the tests with Jira tickets associated with them i.e.: test_one JIRA-234 open test_two JIRA-342 assigned test_three JIRA-1 closed

lukas-bednar commented 5 years ago

Hi thanks for proposal, do you have some certain idea how it should be implemented? So that we can nail it down.

yoram-s commented 5 years ago

Hi, I would think to add a hook to pytest_runtest_setup in that hook implement something like:

def pytest_runtest_setup(item):
    if item.config.getoption("--jira-doc"):
        dump_test(item)

In the dump_test(item) iterate on the markers looking for the jira issue. Then populate the info into dictionary with the test-name[arguments] as key and the ticket number and state as values eventually in pytest_unconfigure(config) hook you should dump the dictionary into json file or any other formatted output