Python Integration
Description
AssertThat - BDD & Cucumber for Jira provides a Python Integration library to enable integration with your automated test framework:
Download Feature files
The scenarios and feature files can be downloaded from the plugin into your automation test framework using the plugin provided. In addition to using tags to filter the scenarios for execution, the plugin provides 3 optional fields:
JIRA JQL - JQL filters can be developed using the JIRA's advanced searching functionality e.g. “Sprint = 5”.
mode - This field is set for each scenario in AssertThat and is set as default to Automated - Automated and Manual tests.
tags - tag expression filter for scenarios e.g. tags = "(@smoke or @ui) and (not @slow)". More on tag expressions https://cucumber.io/docs/cucumber/api/#tag-expressions
Upload test results (cucumber json file) into AssertThat
The AssertThat - BDD Test Automation in Jira will parse the results of the cucumber json file and load them so that the results can be viewed in Jira alongside the user stories - Test Execution status for User Stories. The automated test results will automatically be linked to existing defects and the results loaded into the reporting tool. The failed tests can then be easily reviewed and assigned for further analysis - Automated Test Report Analysis.
Mandatory Fields
The only mandatory field required is the projectId. The following parameters are also required however can be passed as environment variables - ASSERTTHAT_ACCESS_KEY
and the ASSERTTHAT_SECRET_KEY
. All 3 parameters are available from the AssertThat Configuration page - AssertThat Configuration.
Usage - assertthat-bdd
Usage - assertthat-bdd
Installation
To add the library to your project:
pip install assertthat-bdd
from assertthat_bdd.jira_integration import JiraConnector
Configuration
from assertthat_bdd.jira_integration import JiraConnector
JiraConnector.download_features(
# Jira project id e.g. 10001
project_id='PROJECT_ID',
# Optional can be supplied as environment variable ASSERTTHAT_ACCESS_KEY
access_key='ASSERTTHAT_ACCESS_KEY',
# Optional can be supplied as environment variable ASSERTTHAT_SECRET_KEY
secret_key='ASSERTTHAT_SECRET_KEY',
# Optional - default ./features
output_folder='./features',
#Required for Jira Server only. Omit if using Jira Cloud version
jira_server_url='https://mycompanyjira.com'
# Optional - all features downloaded by default - should be a valid JQL
# jql = 'project = XX AND key in ('XXX-1')',
# Optional - default automated (can be one of: manual/automated/both)
mode='both',
#Optional - tag expression filter for scenarios. More on tag expressions https://cucumber.io/docs/cucumber/api/#tag-expressions
tags: '(@smoke or @ui) and (not @slow)',
# Optional - Detail the proxy with the specific scheme e.g.'10.10.10.10:1010'
# proxy_uri='proxyip:port',
proxy_uri= 'proxy_uri',
# Optional - user name which will be used for proxy authentication.*/
proxy_username='username',
# Optional - password which will be used for proxy authentication.*/
proxy_password='password'
)
JiraConnector.upload_report(
# Jira project id e.g. 10001
project_id='PROJECT_ID',
# Optional can be supplied as environment variable ASSERTTHAT_ACCESS_KEY
access_key='ASSERTTHAT_ACCESS_KEY',
# Optional can be supplied as environment variable ASSERTTHAT_SECRET_KEY
secret_key='ASSERTTHAT_SECRET_KEY',
# The name of the run - default 'Test run dd MMM yyyy HH:mm:ss'
run_name= 'Dry Tests Run',
#Required for Jira Server only. Omit if using Jira Cloud version
jira_server_url='https://mycompanyjira.com'
# Json report folder - default ./reports
json_report_folder='./reports',
# Regex to search for cucumber reports - default "\.json$"
json_report_include_pattern='\.json$',
# Optional - default cucumber (can be one of: cucumber/karate)
type='cucumber'',
# Optional - Detail the proxy with the specific scheme e.g.'10.10.10.10:1010'
# proxy_uri='proxyip:port',
# Optional - user name which will be used for proxy authentication.*/
proxy_username='username',
# Optional - password which will be used for proxy authentication.*/
proxy_password='password'
)
Usage
We recommend running cucumber tests on integration-test phase as
download features is running on pre-integration-test phase
report submission on post-integration-test
Example project
Refer to example project - https://github.com/assertthat/assertthat-bdd-python-example