Appium Configuration Reference
@testrelic/appium-analytics is configured through options passed to TestRelicService (in services) and TestRelicReporter (in reporters) in your wdio.conf.ts.
This page covers @testrelic/appium-analytics options. For Playwright configuration, see the Playwright Configuration reference.
TestRelicService options
TestRelicService runs during each test session. It collects device logs, network traffic, commands, and screenshots. Pass options as the second element of the service tuple:
services: [
[TestRelicService, {
includeDeviceLogs: true,
includeNetworkLogs: true,
screenshotOnEvery: 'failure',
}],
],
| Option | Type | Default | Description |
|---|---|---|---|
includeDeviceLogs | boolean | true | Capture Android logcat / iOS syslog per test |
includeNetworkLogs | boolean | true | Capture HTTP network traffic |
includeConsoleLogs | boolean | true | Capture browser/app console output |
includeScreenshots | boolean | true | Capture screenshots |
screenshotOnEvery | 'test' | 'failure' | 'never' | 'failure' | When to capture screenshots |
includeVideoRecording | boolean | false | Capture screen video (performance impact) |
includeCommands | boolean | true | Capture every WebDriver command with args and timing |
includeAssertions | boolean | true | Capture assertion results |
includeActionSteps | boolean | true | Capture named action steps |
deviceLogPollInterval | number | 1000 | Milliseconds between device log polls |
preferBiDi | boolean | true | Prefer BiDi protocol for network capture (falls back to proxy if unavailable) |
TestRelicReporter options
TestRelicReporter runs after all tests complete. It writes the structured report file and optionally uploads to the cloud. Pass options as the second element of the reporter tuple:
reporters: [
'spec',
[TestRelicReporter, {
outputPath: './test-results/testrelic-timeline.json',
openReport: true,
cloud: {
apiKey: process.env.TESTRELIC_API_KEY,
},
}],
],
Core options
| Option | Type | Default | Description |
|---|---|---|---|
outputPath | string | './test-results/testrelic-timeline.json' | Path for the JSON report file |
htmlReportPath | string | Derived from outputPath (.html extension) | Path for the HTML report file |
openReport | boolean | true | Open the HTML report in the browser after the run |
testRunId | string | Auto-generated UUID | Override the run ID — useful for correlating with CI build numbers |
reportMode | 'streaming' | 'batched' | 'streaming' | How the reporter writes the JSON file |
streamingThreshold | number | 0 | Minimum number of tests before streaming kicks in |
redactPatterns | (string | RegExp)[] | 4 built-in patterns | Additional patterns to redact from output (appended to built-in patterns) |
metadata | Record<string, unknown> | undefined | Custom metadata attached to the report |
quiet | boolean | false | Suppress the console summary printed after the run |
cloud | CloudReporterOptions | undefined | Cloud upload configuration — see below |
reportMode and streamingThreshold
reportMode: 'streaming' (the default) writes each test result to the JSON file as it completes, rather than buffering everything in memory. This reduces peak memory usage for large test suites. streamingThreshold: 0 (the default) means streaming is always active. Set it to a higher number to only use streaming for runs with many tests.
redactPatterns
Built-in patterns already redact AWS access keys, Bearer tokens, and private key blocks. The redactPatterns option appends additional patterns — it does not replace the built-ins.
redactPatterns: [
/api_key=[^&\s]+/gi,
/password=[^&\s]+/gi,
]
Cloud upload options (CloudReporterOptions)
The cloud object inside reporter options controls cloud upload behaviour.
| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | — | Required. Your TestRelic API key |
endpoint | string | 'https://platform.testrelic.ai/api/v1' | Cloud API endpoint (override for self-hosted) |
upload | boolean | true | Enable/disable upload |
timeout | number | 30000 | Upload request timeout in milliseconds |
projectName | string | undefined | Project name tag attached to the run |
uploadArtifacts | boolean | true | Upload screenshots and video alongside the report |
artifactMaxSizeMb | number | 50 | Maximum total artifact size to upload (MB) |
queueMaxAge | number | 7 | Days to retain failed uploads in the local queue before discarding |
queueDirectory | string | System temp path | Directory where failed uploads are queued for retry |
Retry queue
If an upload fails (e.g., network error), the reporter writes the payload to the local queue directory and retries on the next run. Entries older than queueMaxAge days are automatically discarded. Configure queueDirectory to a project-specific path if you need deterministic queue locations across CI agents.
Full configuration example
- For AI agents
- For Human
Generate a full configuration with an AI assistant
Update my wdio.conf.ts to use @testrelic/appium-analytics with a production CI configuration:
services:
- TestRelicService with:
includeDeviceLogs: true
includeNetworkLogs: true
includeScreenshots: true
screenshotOnEvery: 'failure'
includeCommands: true
includeActionSteps: true
preferBiDi: true
reporters:
- TestRelicReporter with:
outputPath: './test-results/testrelic-timeline.json'
openReport: false
testRunId: process.env.CI_BUILD_ID (or null if not set)
reportMode: 'streaming'
metadata: { branch: process.env.CI_BRANCH, commit: process.env.CI_COMMIT_SHA }
cloud: { apiKey: process.env.TESTRELIC_API_KEY, uploadArtifacts: true, artifactMaxSizeMb: 100 }
Also add an onComplete hook that calls TestRelicReporter.finalize().
Add 'import dotenv/config' at the top.
Show me the complete updated file.
Update my wdio.conf.ts to use @testrelic/appium-analytics with minimal local-only configuration.
No cloud upload needed — just capture device logs and screenshots on failure.
Show me the updated services and reporters sections only.
Update my wdio.conf.ts to add custom redactPatterns to TestRelicService.
I want to redact:
- Any string matching /auth_token=[^&\s]+/gi
- Any string matching /x-api-key:\s*\S+/gi
Show me the updated service options.
import { join } from 'node:path';
import 'dotenv/config';
import { TestRelicService } from '@testrelic/appium-analytics/service';
import { TestRelicReporter } from '@testrelic/appium-analytics';
const REPORT_DIR = join(process.cwd(), 'test-results');
async function onComplete() {
try {
await TestRelicReporter.finalize(process.cwd());
} catch (err) {
process.stderr.write(`[TestRelic] Finalization failed: ${err}\n`);
}
}
export const config = {
runner: 'local',
port: 4723,
path: '/',
specs: ['./tests/**/*.test.ts'],
maxInstances: 1,
capabilities: [{
platformName: 'Android',
'appium:automationName': 'UiAutomator2',
'appium:deviceName': 'emulator-5554',
'appium:app': join(process.cwd(), 'apps', 'MyApp.apk'),
}],
framework: 'mocha',
mochaOpts: { ui: 'bdd', timeout: 60000 },
services: [
[TestRelicService, {
includeDeviceLogs: true,
includeNetworkLogs: true,
includeScreenshots: true,
screenshotOnEvery: 'failure',
includeCommands: true,
includeActionSteps: true,
preferBiDi: true,
}],
],
reporters: [
'spec',
[TestRelicReporter, {
outputPath: join(REPORT_DIR, 'testrelic-timeline.json'),
openReport: false,
testRunId: process.env.CI_BUILD_ID,
reportMode: 'streaming',
metadata: {
branch: process.env.CI_BRANCH,
commit: process.env.CI_COMMIT_SHA,
},
cloud: {
apiKey: process.env.TESTRELIC_API_KEY,
uploadArtifacts: true,
artifactMaxSizeMb: 100,
},
}],
],
onComplete,
};
Minimal configuration (local only)
services: [
[TestRelicService, {}],
],
reporters: [
'spec',
[TestRelicReporter, {
outputPath: './test-results/testrelic-timeline.json',
}],
],
All options use their defaults — device logs, commands, screenshots on failure, and the streaming report writer are all active.