Skip to main content

Qase TestOps Behave Reporter

PyPI version PyPI downloads License

Qase Behave Reporter enables seamless integration between your Behave BDD tests and Qase TestOps, providing automatic test result reporting, test case management, and comprehensive test analytics.

Features

  • Link automated tests to Qase test cases by ID
  • Auto-create test cases from your feature files
  • Report test results with rich metadata (fields, attachments)
  • Automatic step reporting from Gherkin scenarios
  • Multi-project reporting support
  • Flexible configuration (file, environment variables)
  • BehaveX parallel execution support

Installation

pip install qase-behave

Quick Start

1. Create qase.config.json in your project root:

{
  "mode": "testops",
  "testops": {
    "project": "YOUR_PROJECT_CODE",
    "api": {
      "token": "YOUR_API_TOKEN",
      "host": "qase.io"
    }
  }
}

If your workspace is on the EU cluster (you open Qase at app-eu.qase.io), set host to eu.qase.io. The default, qase.io, is the US cluster.

2. Add Qase ID to your scenario:

Feature: Authentication

  @qase.id:1
  Scenario: User can log in with valid credentials
    Given I am on the login page
    When I enter valid credentials
    Then I should see the dashboard

3. Run your tests:

behave --format=qase.behave.formatter:QaseFormatter

Configuration

The reporter is configured via (in order of priority):

  1. Environment variables (QASE_*, highest priority)
  2. Config file (qase.config.json)

Minimal Configuration

Option Environment Variable Description
mode QASE_MODE Set to testops to enable reporting
testops.project QASE_TESTOPS_PROJECT Your Qase project code
testops.api.token QASE_TESTOPS_API_TOKEN Your Qase API token
testops.api.host QASE_TESTOPS_API_HOST qase.io (US cluster, the default) or eu.qase.io (EU cluster). Required if your workspace is on the EU cluster

Example qase.config.json

{
  "mode": "testops",
  "fallback": "report",
  "testops": {
    "project": "YOUR_PROJECT_CODE",
    "api": {
      "token": "YOUR_API_TOKEN",
      "host": "qase.io"
    },
    "run": {
      "title": "Behave Automated Run"
    },
    "batch": {
      "size": 100
    }
  },
  "report": {
    "driver": "local",
    "connection": {
      "local": {
        "path": "./build/qase-report",
        "format": "json"
      }
    }
  }
}

Full configuration reference: See qase-python-commons for all available options including logging, status mapping, execution plans, and more.

Usage

Associate your scenarios with Qase test cases using the @qase.id tag:

Feature: Shopping Cart

  @qase.id:1
  Scenario: Add item to cart
    Given I am on the product page
    When I click add to cart
    Then the item should be in my cart

  @qase.id:2
  Scenario: Remove item from cart
    Given I have an item in my cart
    When I click remove
    Then my cart should be empty

Add Metadata

Enhance your scenarios with additional information using the @qase.fields tag:

Feature: Checkout

  @qase.id:1
  @qase.fields:{"severity":"critical","priority":"high","layer":"e2e"}
  @qase.suite:Checkout
  Scenario: Complete purchase
    Given I have items in my cart
    When I complete checkout
    Then I should see order confirmation

Note: In field values, use underscores (_) instead of spaces. They will be automatically converted.

Ignore Tests

Exclude specific scenarios from Qase reporting:

Feature: Authentication

  @qase.ignore
  Scenario: Work in progress test
    Given this test is not ready
    Then it should not be reported

Test Result Statuses

Behave Result Qase Status
Passed passed
Failed (AssertionError) failed
Failed (other exception) invalid
Skipped skipped

Attachments

Attach files and content to test results in step definitions:

from behave import given, when, then
from qase.behave import qase

@when('I take a screenshot')
def step_impl(context):
    screenshot = context.browser.get_screenshot_as_png()
    qase.attach(content=screenshot, file_name="screenshot.png", mime_type="image/png")

For detailed usage examples, see the Usage Guide.

Running Tests

Basic Execution

behave --format=qase.behave.formatter:QaseFormatter

With Environment Variables

export QASE_MODE=testops
export QASE_TESTOPS_PROJECT=PROJ
export QASE_TESTOPS_API_TOKEN=your_token
export QASE_TESTOPS_API_HOST=qase.io  # eu.qase.io for the EU cluster
behave --format=qase.behave.formatter:QaseFormatter

With Custom Run Title

export QASE_TESTOPS_RUN_TITLE="Regression Run"
behave --format=qase.behave.formatter:QaseFormatter

Parallel Execution with BehaveX

Run tests in parallel using BehaveX (v4.0.0+):

pip install behavex

behavex --formatter=qase.behave.formatter:QaseFormatter --parallel-processes=4 features/

# Parallel by feature
behavex --formatter=qase.behave.formatter:QaseFormatter --parallel-processes=4 --parallel-scheme=feature features/

Configuration is done via environment variables or qase.config.json (the same as for standard behave).

Note: qase.attach() and qase.comment() are not supported in BehaveX mode. All other features (test case linking, metadata, steps, statuses) work normally.

Requirements

  • Python >= 3.9
  • behave >= 1.2.6
  • filelock >= 3.12.2
  • BehaveX >= 4.0.0 (optional, for parallel execution)

Documentation

Guide Description
Usage Guide Complete usage reference with all tags and options
Attachments Adding screenshots, logs, and files to test results
Multi-Project Support Reporting to multiple Qase projects

Examples

See the examples directory for complete working examples.

License

Apache License 2.0. See LICENSE for details.

Metadata

Release files for qase-behave 4.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qase-behave 4.0.1
File Size Uploaded Provenance Actions
qase_behave-4.0.1.tar.gz 29.5 kB Without provenance Details for qase_behave-4.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for qase-behave 4.0.1
File Interpreter ABI Platform Actions
qase_behave-4.0.1-py3-none-any.whl Python 3 none any Details for qase_behave-4.0.1-py3-none-any.whl

Total release size: 46.9 kB

Release files / qase_behave-4.0.1.tar.gz

Download URL qase_behave-4.0.1.tar.gz
Size 29.5 kB
Tags Source
SHA-256 checksum
How to use checksums
209b7ca1fcf56fcb5e439f501b15f3bfe03fe0eab359d8026ab06baf68251fbc
BLAKE2b-256 checksum
How to use checksums
62e59ec2e438ec1d5fa4e4ee423c4c2f8e5beb38ce2a9bd6581c1390e3c6cb13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / qase_behave-4.0.1-py3-none-any.whl

Download URL qase_behave-4.0.1-py3-none-any.whl
Size 17.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
97c8936b4d4f25e7eb48a3cb7a0f68afcde9fdd9bbc1d45bb289341e222ad4ff
BLAKE2b-256 checksum
How to use checksums
3877aa0d0f0fc88f4f1161f657609243ac68c9cc1391eb1ed37532c29d38b407
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for qase-behave 4.0.1

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page