Please note this article is only for classic projects type.
Behave Pro can export the created Feature and Scenarios to any gherkin compatible test automation tool. For Python based projects we have a library that will export the features directly from Jira from any python script.
Installation
We host our Python client PyPi, and it is available through pip or by direct download. Assuming you have Python and pip installed on your system, run:
$ pip install hindsight
You will have installed the behave python client and all its dependencies. Depending on your system, you may have to prefix the command with “sudo”.
Using from the command line
Installing the package will have placed a binary on your path named “behave-cli”. The output of “behave-cli –help” is as follows:
$ behave-cli HOST KEY [-u USERNAME] [-p PASSWORD] [-d DIR] [-m]
An example usage would be:
$ behave-cli https://behave.pro 10100 \
-u "Cloud userId OR Jira Server Username" \
-p "Cloud API key OR Jira Server Password" \
-d features \
-m
Note: For Behave Pro Cloud the above host should be used, but for Jira Server, enter your full Jira instance URL. This article has more information on finding these configuration items
This example uses your API key user name and value to download features from project ID 10100 into the features directory, including all manual scenarios.
Using from within a script
You can use the Jira connector within your own scripts to download features from Behave
#!/usr/bin/env python
from hindsight.behave import JiraConnector
jc = JiraConnector()
jc.fetch(
host='https://behave.pro',
username='Cloud userId OR Jira Server Username',
password='Cloud API key OR Jira Server Password',
key='10100',
dir='features',
manual=True
)
The task has four required parameters, host
, Key
, username
and password
. These 4 parameters are different depending on if you are using Jira Cloud or Server. You can retrieve the correct details of the Jira project's admin area; 'Project Settings' > 'Behave Pro' > 'Generate config'. This article has more information on finding these configuration items