Code that supports the tutorial Testing using Behave in Python showcasing the integration between Xray Test Management on Jira and Behave.
The test automation code implements some basic and dummy tests (credits to the Behave team), just to briefly showcase Behave usage.
In order to run this tutorial, you need to have Python 3.x (e.g. 3.8). Dependencies can be installed using:
pip3 install -r requirements.txt
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 behave
tool.
export PYTHONPATH=.
behave --format=cucumber_json126:PrettyCucumberJSONFormatter -o results/cucumber.json --format=json -o results/behave.json features
Tests can also run inside a Docker container; local directory should be mounted so that Behave results are stored locally.
docker build . -t behave_tests
docker run --rm -v $(pwd)/results:/source/results -t behave_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.
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.