Qase Behave Plugin for Qase TestOps and Qase Report
Project description
Qase TestOps Behave Reporter
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"
}
}
}
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):
- Environment variables (
QASE_*, highest priority) - 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 |
Example qase.config.json
{
"mode": "testops",
"fallback": "report",
"testops": {
"project": "YOUR_PROJECT_CODE",
"api": {
"token": "YOUR_API_TOKEN"
},
"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
Link Tests with Test Cases
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
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()andqase.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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qase_behave-3.2.0.tar.gz.
File metadata
- Download URL: qase_behave-3.2.0.tar.gz
- Upload date:
- Size: 23.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c64e5872db28db7cc95c98f9c0e7b8a9e484470f6a37d7f22ebc3766877a704
|
|
| MD5 |
5e1013c85537ac01318c035945df0b8c
|
|
| BLAKE2b-256 |
eab25a630c58ff93116812d3b81f5c6fcbc7558a98e15d95e4b2bed9341a01c1
|
File details
Details for the file qase_behave-3.2.0-py3-none-any.whl.
File metadata
- Download URL: qase_behave-3.2.0-py3-none-any.whl
- Upload date:
- Size: 15.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d14729c95a86a70cb98ffed8c3b19ab4c980bbda0992053a43c39690ee824036
|
|
| MD5 |
d850d4834df66545e0b43aee66f6c5ac
|
|
| BLAKE2b-256 |
3e5e4c1591fc82d6f5a0af7fbfcc307836467cb81d972c924b5bf5c897d7b440
|