cucumberjs-qase-reporter
v2.4.4
Published
Qase TMS CucumberJS Reporter
Downloads
6,904
Readme
Qase TestOps CucumberJS Reporter
Qase CucumberJS Reporter enables seamless integration between your CucumberJS 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 using Gherkin tags
- Auto-create test cases from your Gherkin scenarios
- Report test results with rich metadata (fields, attachments, steps)
- Native Gherkin step reporting (Given/When/Then automatically mapped)
- Multi-project reporting support
- Flexible configuration (file, environment variables, CucumberJS formatter)
- Network Profiler for automatic HTTP request capture
Installation
npm install --save-dev cucumberjs-qase-reporterQuick 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 tag to your Gherkin scenario:
Feature: User Authentication
@QaseID=1
Scenario: Successful login
Given I am on the login page
When I enter valid credentials
Then I should be logged in3. Run your tests with the reporter:
QASE_MODE=testops npx cucumber-js -f cucumberjs-qase-reporterConfiguration
The reporter is configured via (in order of priority):
- CucumberJS CLI flags (highest priority)
- Environment variables (
QASE_*) - Config file (
qase.config.json)
CucumberJS Formatter Configuration
Run CucumberJS with the Qase formatter:
npx cucumber-js -f cucumberjs-qase-reporter features -r step_definitionsOr configure in your cucumber.js profile:
// cucumber.js
module.exports = {
default: {
format: ['progress', 'cucumberjs-qase-reporter'],
requireModule: ['ts-node/register'],
require: ['step_definitions/**/*.js'],
},
};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": "CucumberJS Automated Run"
},
"batch": {
"size": 100
}
},
"report": {
"driver": "local",
"connection": {
"local": {
"path": "./build/qase-report",
"format": "json"
}
}
}
}Full configuration reference: See qase-javascript-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 Gherkin tags:
Single ID:
Feature: User Authentication
@QaseID=1
Scenario: Valid login
Given I am on the login page
When I enter valid credentials
Then I should see the dashboardMultiple IDs:
Feature: User Authentication
@QaseID=1,2,3
Scenario: Multiple test case coverage
Given I am on the login page
When I enter valid credentials
Then I should see the dashboardNote: Unlike other frameworks, CucumberJS uses Gherkin tags (
@QaseID=N) instead of programmatic wrapper functions. Test case linking happens at the scenario level in feature files.
Add Metadata
Enhance your scenarios with additional information using tags:
Using Gherkin Tags:
Feature: User Authentication
@QaseID=1
@QaseTitle=Custom Test Title
@QaseFields={"severity":"critical","priority":"high","layer":"e2e"}
Scenario: Login with metadata
Given I am on the login page
When I enter valid credentials
Then I should see the dashboardProgrammatic Metadata (in Before hooks):
// support/hooks.js
const { Before } = require('@cucumber/cucumber');
Before(function() {
// Note: programmatic metadata requires custom implementation
// Most metadata is set via Gherkin tags
});Ignore Tests
Exclude specific scenarios from Qase reporting (scenario still runs, but results are not sent):
Feature: User Authentication
@QaseIgnore
Scenario: Test not reported to Qase
Given I am on the login page
When I enter valid credentials
Then I should see the dashboardTest Result Statuses
| CucumberJS Result | Qase Status | |-------------------|-------------| | Passed | Passed | | Failed | Failed | | Pending | Blocked | | Skipped | Skipped | | Undefined | Blocked | | Ambiguous | Failed |
For more usage examples, see the Usage Guide.
Running Tests
Basic test execution with reporter:
QASE_MODE=testops npx cucumber-js -f cucumberjs-qase-reporterWith specific features:
QASE_MODE=testops npx cucumber-js -f cucumberjs-qase-reporter features/login.featureWith tags filtering:
npx cucumber-js -f cucumberjs-qase-reporter --tags "@smoke and not @skip"Using cucumber.js profile:
npx cucumber-js --profile defaultNote: The reporter formatter should be specified with
-f cucumberjs-qase-reporterflag or in your cucumber.js configuration.
Network Profiler
The Network Profiler automatically captures outgoing HTTP requests made during test execution and reports them as REQUEST-type steps in Qase TestOps.
Enable in qase.config.json:
{
"profilers": ["network"],
"networkProfiler": {
"skip_domains": ["analytics.example.com"],
"track_on_fail": true
}
}| Option | Description | Default |
|--------|-------------|---------|
| profilers | Array of profilers to enable. Use ["network"] for HTTP capture | [] |
| networkProfiler.skip_domains | Domains to exclude from profiling | [] |
| networkProfiler.track_on_fail | Capture response body for failed requests (status >= 400) | true |
Requests to
qase.ioare always excluded automatically.
Requirements
- Node.js >= 14
- @cucumber/cucumber >= 8.0.0
Documentation
| Guide | Description | |-------|-------------| | Usage Guide | Complete usage reference with all tags and patterns | | Attachments | Adding screenshots, logs, and files to test results | | Steps | Understanding native Gherkin step mapping | | Multi-Project Support | Reporting to multiple Qase projects | | Upgrade Guide | Migration guide for breaking changes |
Examples
See the examples directory for complete working examples.
License
Apache License 2.0. See LICENSE for details.
