behave-xray


Namebehave-xray JSON
Version 0.2.1 PyPI version JSON
download
home_pagehttps://github.com/fundakol/behave-xray
SummaryBehave JIRA XRAY results uploader
upload_time2023-05-15 17:02:17
maintainer
docs_urlNone
authorLukasz Fundakowski
requires_python
license
keywords behave jira xray
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # behave-xray

[![PyPi](https://img.shields.io/pypi/v/behave-xray.png)](https://pypi.python.org/pypi/behave-xray)
[![Build Status](https://github.com/fundakol/behave-xray/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/fundakol/behave-xray/actions?query=workflow?master)
[![codecov](https://codecov.io/gh/fundakol/behave-xray/branch/master/graph/badge.svg?token=VV1DMT3605)](https://codecov.io/gh/fundakol/behave-xray)

### Installation


```shell
$ pip install -U behave-xray
```

or from the source:

```shell
$ python setup.py install
```
### Usage

Add JIRA tags to Gherkin scenario:

```gherkin
# --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](https://docs.getxray.app/pages/viewpage.action?pageId=62267221):
```gherkin
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:

```shell
$ export XRAY_API_BASE_URL=<jira URL>
```

Set system environments for [basic authentication](https://developer.atlassian.com/server/jira/platform/basic-authentication/):

```shell
$ export XRAY_API_USER=<jria username>
$ export XRAY_API_PASSWORD=<user password>
```
Set system environments for [Personal Access Tokens](https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html) authentication:
```shell
$ export XRAY_TOKEN=<Xray token>
```

Set system environments for Could server authentication with [Client ID and Client Secret](https://docs.getxray.app/display/XRAYCLOUD/Authentication+-+REST+v2):
```shell
$ export XRAY_CLIENT_ID=<Xray client id>
$ export XRAY_CLIENT_SECRET=<Xray client secret>
```

### Run tests

Run tests against [Jira Xray Server+DC](https://docs.getxray.app/display/XRAY/REST+API):
```shell
$ behave -f behave_xray:XrayFormatter
```

Run tests against [Jira Xray Cloud](https://docs.getxray.app/display/XRAYCLOUD/REST+API) server:
```shell
$ behave -f behave_xray:XrayCloudFormatter
```

You can register formatter in `behave.ini`:
```ini
# -- FILE: behave.ini
[behave.formatters]
xray = behave_xray:XrayCloudFormatter
```

and use with shorter name:
```shell
$ behave --f xray
```

### Attach an evidence to the scenario

One can implement `scenario_xray_result` hook to update results for a scenario.

```python
# - 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:

```shell
$ behave -f behave_xray:XrayCloudFormatter -D xray.summary='Report generated by behave'
```
or from `behave.ini` file:

```ini
# -- FILE: behave.ini
[behave.userdata]
xray.summary = Report generated by behave
```

Available options:

* `xray.summary`
* `xray.user`
* `xray.version`
* `xray.revision`

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/fundakol/behave-xray",
    "name": "behave-xray",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "behave JIRA XRAY",
    "author": "Lukasz Fundakowski",
    "author_email": "fundakol@yahoo.com",
    "download_url": "",
    "platform": null,
    "description": "# behave-xray\n\n[![PyPi](https://img.shields.io/pypi/v/behave-xray.png)](https://pypi.python.org/pypi/behave-xray)\n[![Build Status](https://github.com/fundakol/behave-xray/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/fundakol/behave-xray/actions?query=workflow?master)\n[![codecov](https://codecov.io/gh/fundakol/behave-xray/branch/master/graph/badge.svg?token=VV1DMT3605)](https://codecov.io/gh/fundakol/behave-xray)\n\n### Installation\n\n\n```shell\n$ pip install -U behave-xray\n```\n\nor from the source:\n\n```shell\n$ python setup.py install\n```\n### Usage\n\nAdd JIRA tags to Gherkin scenario:\n\n```gherkin\n# --FILE: tutorial.feature\n@jira.test_plan('JIRA-3')\nFeature: showing off behave\n    Feature's description\n\n  @jira.testcase('JIRA-1')\n  Scenario: run a simple test\n     Given we have behave installed\n      When we implement a test\n      Then behave will test it for us!\n\n  @jira.testcase('JIRA-2')\n  Scenario Outline: Add two numbers in Calc\n    Given Calculator is open\n    When I add <a> and <b>\n    Then result is <result>\n\n  Examples: Sum\n      | a | b  | result |\n      | 3 | 4  | 7      |\n      | 6 | 10 | 18     |\n```\n\nThis library also supports the feature files [exported from Xray Cucumber tests](https://docs.getxray.app/pages/viewpage.action?pageId=62267221):\n```gherkin\nFeature: showing off behave\n    Feature's description\n\n  @TEST_JIRA-1\n  Scenario: run a simple test\n     Given we have behave installed\n      When we implement a test\n      Then behave will test it for us!\n\n  @TEST_JIRA-2\n  Scenario Outline: Add two numbers in Calc\n    Given Calculator is open\n    When I add <a> and <b>\n    Then result is <result>\n\n  Examples: Sum\n      | a | b  | result |\n      | 3 | 4  | 7      |\n      | 6 | 10 | 18     |\n```\n\n### Configure Jira URL and authentication\n\nSet Jira server API base URL in system environments:\n\n```shell\n$ export XRAY_API_BASE_URL=<jira URL>\n```\n\nSet system environments for [basic authentication](https://developer.atlassian.com/server/jira/platform/basic-authentication/):\n\n```shell\n$ export XRAY_API_USER=<jria username>\n$ export XRAY_API_PASSWORD=<user password>\n```\nSet system environments for [Personal Access Tokens](https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html) authentication:\n```shell\n$ export XRAY_TOKEN=<Xray token>\n```\n\nSet system environments for Could server authentication with [Client ID and Client Secret](https://docs.getxray.app/display/XRAYCLOUD/Authentication+-+REST+v2):\n```shell\n$ export XRAY_CLIENT_ID=<Xray client id>\n$ export XRAY_CLIENT_SECRET=<Xray client secret>\n```\n\n### Run tests\n\nRun tests against [Jira Xray Server+DC](https://docs.getxray.app/display/XRAY/REST+API):\n```shell\n$ behave -f behave_xray:XrayFormatter\n```\n\nRun tests against [Jira Xray Cloud](https://docs.getxray.app/display/XRAYCLOUD/REST+API) server:\n```shell\n$ behave -f behave_xray:XrayCloudFormatter\n```\n\nYou can register formatter in `behave.ini`:\n```ini\n# -- FILE: behave.ini\n[behave.formatters]\nxray = behave_xray:XrayCloudFormatter\n```\n\nand use with shorter name:\n```shell\n$ behave --f xray\n```\n\n### Attach an evidence to the scenario\n\nOne can implement `scenario_xray_result` hook to update results for a scenario.\n\n```python\n# - FILE: environment.py\nfrom behave.model import Status\nfrom behave_xray import hookimpl\nfrom behave_xray.evidence import text\n\n@hookimpl\ndef scenario_xray_result(result, scenario):\n    if scenario.status == Status.failed:\n        result.evidences.append(text(data='This is scenario evidence', filename=f'{scenario.name}.txt'))\n```\n\n### Customize report\n\nAdd summary to a report:\n\n```shell\n$ behave -f behave_xray:XrayCloudFormatter -D xray.summary='Report generated by behave'\n```\nor from `behave.ini` file:\n\n```ini\n# -- FILE: behave.ini\n[behave.userdata]\nxray.summary = Report generated by behave\n```\n\nAvailable options:\n\n* `xray.summary`\n* `xray.user`\n* `xray.version`\n* `xray.revision`\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Behave JIRA XRAY results uploader",
    "version": "0.2.1",
    "project_urls": {
        "Homepage": "https://github.com/fundakol/behave-xray"
    },
    "split_keywords": [
        "behave",
        "jira",
        "xray"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f295000b57d94dcda0dc4a93a6f301824c3351e50fe49832e244f714fd530ebf",
                "md5": "b63b60b05b2988c19f6d57e695091237",
                "sha256": "469fb3a134f74d124302f621114400d9b8162a31fcfc949322bb0c4a41f5f45e"
            },
            "downloads": -1,
            "filename": "behave_xray-0.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b63b60b05b2988c19f6d57e695091237",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 15359,
            "upload_time": "2023-05-15T17:02:17",
            "upload_time_iso_8601": "2023-05-15T17:02:17.372455Z",
            "url": "https://files.pythonhosted.org/packages/f2/95/000b57d94dcda0dc4a93a6f301824c3351e50fe49832e244f714fd530ebf/behave_xray-0.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-15 17:02:17",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "fundakol",
    "github_project": "behave-xray",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "behave-xray"
}
        
Elapsed time: 0.16163s