TestPlanIt Reporter Reporter
@testplanit/wdio-reporter is a 3rd party package, for more information please see GitHub | npm
WebdriverIO reporter and service for TestPlanIt - report test results directly to your TestPlanIt instance.
This package includes:
- Reporter - Tracks test execution in worker processes and reports results to TestPlanIt
- Service - Manages the test run lifecycle in the main process, ensuring all workers report to a single test run
Installation
npm install @testplanit/wdio-reporter
# or
pnpm add @testplanit/wdio-reporter
# or
yarn add @testplanit/wdio-reporter
Quick Start
1. Generate an API Token
- Log into your TestPlanIt instance
- Go to Settings > API Tokens
- Click Generate New Token
- Copy the token (it starts with
tpi_)
2. Configure the Reporter and Service
Add both the service and reporter to your wdio.conf.js or wdio.conf.ts:
// wdio.conf.js
import { TestPlanItService } from '@testplanit/wdio-reporter';
export const config = {
services: [
[TestPlanItService, {
domain: 'https://testplanit.example.com',
apiToken: process.env.TESTPLANIT_API_TOKEN,
projectId: 1,
runName: 'E2E Tests - {date} {time}',
captureScreenshots: true,
}]
],
reporters: [
['@testplanit/wdio-reporter', {
domain: 'https://testplanit.example.com',
apiToken: process.env.TESTPLANIT_API_TOKEN,
projectId: 1,
}]
],
// ... rest of config
}
Note: The service is recommended when running with
maxInstances > 1. It creates a single test run before workers start, eliminating race conditions. Without the service, the reporter can still manage test runs on its own using file-based coordination (oneReport: true).
Service vs Reporter
| Aspect | Service | Reporter |
|---|---|---|
| Process | Main WDIO process | Each worker process |
| Timing | Runs once before/after all workers | Runs in each worker |
| Test run creation | Creates in onPrepare | Fallback: creates if no service |
| Result reporting | - | Reports each test result |
| Screenshot capture | Optional (captureScreenshots) | - |
| Screenshot upload | - | Uploads in onRunnerEnd |
| Run completion | Completes in onComplete | Skips if service-managed |
Linking Test Cases
Embed TestPlanIt case IDs in your test titles using brackets (configurable via caseIdPattern):
describe('Authentication', () => {
it('[12345] should login with valid credentials', async () => {
// This test will be linked to case ID 12345
});
it('[12346] [12347] should show error for invalid password', async () => {
// This test will be linked to multiple cases: 12346 and 12347
});
it('should redirect to dashboard after login', async () => {
// No case ID - will be skipped unless autoCreateTestCases is enabled
});
});
Custom Case ID Patterns
The caseIdPattern option accepts a regex with a capturing group for the numeric ID:
// Default: brackets - "[12345] should work"
caseIdPattern: /\[(\d+)\]/g
// C-prefix: "C12345 should work"
caseIdPattern: /C(\d+)/g
// TC- prefix: "TC-12345 should work"
caseIdPattern: /TC-(\d+)/g
// JIRA-style: "TEST-12345 should work"
caseIdPattern: /TEST-(\d+)/g