Code that supports the tutorial Testing using Cucumber in Java showcasing the integration between Xray Test Management on Jira and Cucumber (Java).
The test automation code implements some basic tests (i.e. scenarios/scenario outlines) for a dummy calculator, using two stories (i.e. addition and multiplication) as the features we aim to deliver.
In order to run this tutorial, you need to have Java (i.e. a JDK) and Maven. Dependencies aree installed automatically whenever running Maven.
The straighforward approach to run everything in a single shot is to invoke the auxiliary script run_all_cloud_standard_workflow.sh. You need to update the client_id and client_secret to interact with your Xray cloud instance (obtainable from Xray API Keys section); you also need to update the issue keys of the corresponding stories in Jira, that you'll use as basis to generate the .feature file(s).
Remember that to be able to run the scenarios, we need to have the corresponding .feature files. The previous script assumes you are using Xray to manage the specification of the scenarios, so you need to extract them from Jira (more on the possible workflows here).
When you have the .feature files, containing the Feature along with the Scenario properly tagged, you can finally run the tests using the mvn
tool.
mvn clean compile test -Dcucumber.plugin="json:report.json" -Dcucumber.features="features/"
We need to specify that we want a Cucumber JSON report as output, and also the path where the .feature files are at.
Tests can also run inside a Docker container; local directory/file should be mounted so that Cucumber results are stored locally.
docker build . -t cucumber_java_tests
docker run --rm -v $(pwd)/report.json:/source/report.json -t cucumber_java_tests
Results can be submitted to Jira so that they can be shared with the team and their impacts be easily analysed. This can be achieved using Xray Test Management as shown in further detail in this tutorial. This repo contains an auxiliary script import_results_cloud.sh that does that; it uses a configuration file to have Xray's client_id and client_secret. You can also have a look at the workflows implemented in this repo using GitHub Actions.
This repo also contains some auxiliary shell scripts, provided as an example; feel free to download and customize them to your needs. You may find scripts for interacting both with Xray server/DC or Xray cloud, which have slightly different APIs.
Any questions related with this code, please raise issues in this GitHub project. Feel free to contribute and submit PR's. For Xray specific questions, please contact Xray's support team.