Page tree
Skip to end of metadata
Go to start of metadata

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:

  1. Have Zephyr installed on your JIRA.
  2. Have ZAPI installed on your JIRA.
  3. Have a project which contains Zephyr tests in them corresponding to the Selenium tests.
  4. Have a valid fixVersion set up for the project above.
  5. 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:

jira.properties
jira.user: The username of the JIRA account used to execute tests.
jira.password: The password of the above account.
jira.url: URL for JIRA.
jira.project: Project key for project that contains the tests (e.g. XNAT).
jira.project.version: Version under which to file the cycle.
jira.cycleName: Name for cycle to be created. Always includes timestamp added on to the end. Defaults to "Selenium test suite cycle"
jira.steps: Should screenshots be uploaded for relevant steps? Defaults to false.

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:

  1. In the @BeforeSuite phase (i.e. exactly once, on test initialization), we:
    1. Do a GET to the project's URL and extract the project ID from the response.
    2. 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.
    3. 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.
    4. For every valid test found in jiraTests.csv, do a POST to the cycle to create an execution of the test in Unexecuted status.
  2. For each @Test which has a valid execution created, we:
    1. When the test starts, do a PUT to update the corresponding test execution to WIP (Work in Progress).
    2. If the JIRA Zephyr test includes enumerated steps, we can call captureStep(...) in our test, which will update the appropriate step in the execution.
    3. When the test completes, whether it be skipping, passing, or failing, do a PUT to update the corresponding test execution with the appropriate status.

 

 

  • No labels