behave-xray
Installation
$ pip install -U behave-xray
or from the source:
$ python setup.py install
Usage
Add JIRA tags to Gherkin scenario:
# --FILE: tutorial.feature
@jira.test_plan('JIRA-3')
Feature: showing off behave
Feature's description
@jira.testcase('JIRA-1')
Scenario: run a simple test
Given we have behave installed
When we implement a test
Then behave will test it for us!
@jira.testcase('JIRA-2')
Scenario Outline: Add two numbers in Calc
Given Calculator is open
When I add <a> and <b>
Then result is <result>
Examples: Sum
| a | b | result |
| 3 | 4 | 7 |
| 6 | 10 | 18 |
This library also supports the feature files exported from Xray Cucumber tests:
Feature: showing off behave
Feature's description
@TEST_JIRA-1
Scenario: run a simple test
Given we have behave installed
When we implement a test
Then behave will test it for us!
@TEST_JIRA-2
Scenario Outline: Add two numbers in Calc
Given Calculator is open
When I add <a> and <b>
Then result is <result>
Examples: Sum
| a | b | result |
| 3 | 4 | 7 |
| 6 | 10 | 18 |
Configure Jira URL and authentication
Set Jira server API base URL in system environments:
$ export XRAY_API_BASE_URL=<jira URL>
Set system environments for basic authentication:
$ export XRAY_API_USER=<jria username>
$ export XRAY_API_PASSWORD=<user password>
Set system environments for Personal Access Tokens authentication:
$ export XRAY_TOKEN=<Xray token>
Set system environments for Could server authentication with Client ID and Client Secret:
$ export XRAY_CLIENT_ID=<Xray client id>
$ export XRAY_CLIENT_SECRET=<Xray client secret>
Run tests
Run tests against Jira Xray Server+DC:
$ behave -f behave_xray:XrayFormatter
Run tests against Jira Xray Cloud server:
$ behave -f behave_xray:XrayCloudFormatter
You can register formatter in behave.ini:
# -- FILE: behave.ini
[behave.formatters]
xray = behave_xray:XrayCloudFormatter
and use with shorter name:
$ behave --f xray
Attach an evidence to the scenario
One can implement scenario_xray_result hook to update results for a scenario.
# - FILE: environment.py
from behave.model import Status
from behave_xray import hookimpl
from behave_xray.evidence import text
@hookimpl
def scenario_xray_result(result, scenario):
if scenario.status == Status.failed:
result.evidences.append(text(data='This is scenario evidence', filename=f'{scenario.name}.txt'))
Customize report
Add summary to a report:
$ behave -f behave_xray:XrayCloudFormatter -D xray.summary='Report generated by behave'
or from behave.ini file:
# -- FILE: behave.ini
[behave.userdata]
xray.summary = Report generated by behave
Available options:
xray.summaryxray.userxray.versionxray.revision
Metadata
Release files for behave-xray 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| behave_xray-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for behave_xray-0.2.2-py3-none-any.whl |
Release files / behave_xray-0.2.2-py3-none-any.whl
| Download URL | behave_xray-0.2.2-py3-none-any.whl |
|---|---|
| Size | 15.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
49a740e93b6c641d260eec54e7a3fded27444d2d6596863b0a0e79bf8d6cfa02
|
|
BLAKE2b-256 checksum How to use checksums |
14e206a4bdff14074432d75daa3383a62e720ea1c71549ef6dcf1e80b505ff66
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.1.dev0+g94f810c.d20240510 CPython/3.12.3
|
Security for behave-xray 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.