As long as your project and your JIRA are configured correctly, NRG_Selenium provides easy support to post automatic test execution results to JIRA. On the JIRA side, you must:
- Have Zephyr installed on your JIRA.
- Have ZAPI installed on your JIRA.
- Have a project which contains Zephyr tests in them corresponding to the Selenium tests.
- Have a valid fixVersion set up for the project above.
- Have a user with access to the project above.
On the NRG_Selenium side, indicate that you wish to use JIRA integration by setting the base property xnat.jira to true. Then set the JIRA properties in a file called jira.properties or pass them as command line parameters. More details for either option can be found here: Setup and Configuration. The relevant properties are listed below, where all properties except the last two are required:
Finally, create a CSV called jiraTests.csv in src/test/resources/config where each row corresponds to a @Test. Column 0 should be the name of the test in your code, and column 1 is the JIRA key for the corresponding test in JIRA (e.g. XNAT-101). When the above configuration options are set correctly, NRG_Selenium interacts with JIRA as follows:
- In the @BeforeSuite phase (i.e. exactly once, on test initialization), we:
- Do a GET to the project's URL and extract the project ID from the response.
- Do a GET to the project's versions URL using the ID from the previous step, and extract the version ID corresponding to the appropriate version.
- Do a POST to create a new cycle (bucket of test executions to be run) by using the two previous IDs to identify where to put it.
- For every valid test found in jiraTests.csv, do a POST to the cycle to create an execution of the test in Unexecuted status.
- For each @Test which has a valid execution created, we:
- When the test starts, do a PUT to update the corresponding test execution to WIP (Work in Progress).
- If the JIRA Zephyr test includes enumerated steps, we can call captureStep(...) in our test, which will update the appropriate step in the execution.
- When the test completes, whether it be skipping, passing, or failing, do a PUT to update the corresponding test execution with the appropriate status.