wdio-qase-reporter
v1.3.0
Published
Qase WebDriverIO Reporter
Downloads
19,802
Maintainers
Readme
Qase TestOps WebdriverIO Reporter
Qase WebdriverIO Reporter enables seamless integration between your WebdriverIO (WDIO) 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 test code
- Report test results with rich metadata (fields, attachments, steps)
- Support for parameterized tests
- Multi-project reporting support
- Flexible configuration (file, environment variables, wdio.conf.js)
- Support for both Mocha/Jasmine and Cucumber test frameworks
- Network Profiler for automatic HTTP request capture
Installation
npm install --save-dev wdio-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. Configure reporter in wdio.conf.js:
const WDIOQaseReporter = require('wdio-qase-reporter').default;
const { afterRunHook, beforeRunHook } = require('wdio-qase-reporter');
exports.config = {
reporters: [[WDIOQaseReporter, {
disableWebdriverStepsReporting: true,
disableWebdriverScreenshotsReporting: true,
useCucumber: false,
}]],
// Hooks
onPrepare: async function() {
await beforeRunHook();
},
onComplete: async function() {
await afterRunHook();
},
// ... other options
};3. Add Qase ID to your test:
For Mocha/Jasmine:
import { qase } from 'wdio-qase-reporter';
describe('Authentication', () => {
it(qase(1, 'User can log in'), () => {
expect(true).to.equal(true);
});
});For Cucumber:
Feature: User Authentication
@QaseId=1
Scenario: User can log in
Given I am on the login page
When I enter valid credentials
Then I should see the dashboard4. Run your tests:
QASE_MODE=testops npx wdio run wdio.conf.jsConfiguration
The reporter is configured via (in order of priority):
wdio.conf.jsreporter options (WDIO-specific, highest priority)- Environment variables (
QASE_*) - 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": "WDIO Automated Run"
},
"batch": {
"size": 100
}
},
"report": {
"driver": "local",
"connection": {
"local": {
"path": "./build/qase-report",
"format": "json"
}
}
}
}WDIO Reporter Options
Configure in wdio.conf.js:
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| disableWebdriverStepsReporting | boolean | false | Disable automatic step reporting for WebDriver commands |
| disableWebdriverScreenshotsReporting | boolean | false | Disable automatic screenshot attachments |
| useCucumber | boolean | false | Enable Cucumber integration (set to true if using Cucumber) |
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
Mocha/Jasmine - Single ID:
import { qase } from 'wdio-qase-reporter';
describe('Test Suite', () => {
it(qase(1, 'Test with single ID'), () => {
expect(true).to.equal(true);
});
});Mocha/Jasmine - Multiple IDs:
it(qase([1, 2, 3], 'Test linked to multiple cases'), () => {
expect(true).to.equal(true);
});Cucumber - Tags:
@QaseId=1
Scenario: Single test case
@QaseId=2,3,4
Scenario: Multiple test casesAdd Metadata
Mocha/Jasmine:
import { qase } from 'wdio-qase-reporter';
it('Test with metadata', () => {
qase.title('Custom test title');
qase.fields({
'severity': 'critical',
'priority': 'high',
'layer': 'api',
});
qase.suite('Authentication\tLogin');
expect(true).to.equal(true);
});Cucumber:
@QaseId=1
@Title=Custom Test Title
@Suite=Authentication
Scenario: Login with metadata
Given I am on the login pageAdd Steps
Mocha/Jasmine:
import { qase } from 'wdio-qase-reporter';
it('Test with steps', async () => {
await qase.step('Navigate to login page', async (step) => {
await browser.url('/login');
});
await qase.step('Enter credentials', async (step) => {
await step.step('Type email', async () => {
await $('#email').setValue('[email protected]');
});
await step.step('Type password', async () => {
await $('#password').setValue('password123');
});
});
await qase.step('Submit form', async () => {
await $('#login-button').click();
});
});Cucumber: Cucumber steps are automatically reported as Qase steps.
Attach Files
Mocha/Jasmine:
import { qase } from 'wdio-qase-reporter';
it('Test with attachments', async () => {
const screenshot = await browser.takeScreenshot();
qase.attach({
name: 'screenshot.png',
content: screenshot,
type: 'image/png',
});
qase.attach({ paths: '/path/to/log.txt' });
});Cucumber: Use step attachments or configure automatic screenshot capture.
Ignore Tests
Mocha/Jasmine:
it('Ignored test', () => {
qase.ignore();
expect(true).to.equal(true);
});Cucumber: No direct support - use tags to filter tests.
Test Result Statuses
| WDIO Result | Qase Status | |-------------|-------------| | passed | passed | | failed | failed | | skipped | skipped |
For more usage examples, see the Usage Guide.
Running Tests
Basic Execution
# Run all tests
QASE_MODE=testops npx wdio run wdio.conf.js
# Run specific spec file
QASE_MODE=testops npx wdio run wdio.conf.js --spec ./tests/login.spec.js
# Run specific suite
QASE_MODE=testops npx wdio run wdio.conf.js --suite smokeCucumber
# Run Cucumber tests
QASE_MODE=testops npx wdio run wdio.conf.jsEnvironment Variables
# Override configuration
QASE_MODE=testops \
QASE_TESTOPS_PROJECT=DEMO \
QASE_TESTOPS_API_TOKEN=your_token \
npx wdio run wdio.conf.jsParallel Execution
# Run with max instances
QASE_MODE=testops npx wdio run wdio.conf.js --maxInstances 5Multi-Project Support
Qase WebdriverIO Reporter supports sending test results to multiple Qase projects simultaneously using qase.projects():
Mocha/Jasmine:
import { qase } from 'wdio-qase-reporter';
it(qase.projects({ PROJ1: [1], PROJ2: [2] }, 'Multi-project test'), () => {
expect(true).to.equal(true);
});Configuration:
{
"mode": "testops",
"testops": {
"multiproject": {
"enabled": true
}
}
}For detailed information, see the Multi-Project Support Guide.
Network Profiler
The Network Profiler automatically captures outgoing HTTP requests made during test execution and reports them as REQUEST-type steps in Qase TestOps.
Additional setup: Register QaseWdioService in your WDIO configuration:
// wdio.conf.js
const { QaseWdioService } = require('wdio-qase-reporter');
exports.config = {
// ... other config
services: [[QaseWdioService, {}]],
};Note: Network profiling works in same-process WDIO configurations (
maxInstances: 1).
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
- WebdriverIO >= 8.40.0
Documentation
| Guide | Description | |-------|-------------| | Usage Guide | Complete usage reference with all methods and options | | Attachments | Adding screenshots, logs, and files to test results | | Steps | Defining test steps for detailed reporting | | Multi-Project Support | Reporting to multiple Qase projects | | Upgrade Guide | Migration guide for breaking changes | | Configuration Reference | Full configuration options |
Examples
See the examples directory for complete working examples:
- Mocha/Jasmine example
- Cucumber examples (check examples directory)
License
Apache License 2.0. See LICENSE for details.
