Skip to main content
Ask AI

Appium Configuration Reference

@testrelic/appium-analytics is configured through options passed to TestRelicService (in services) and TestRelicReporter (in reporters) in your wdio.conf.ts.

Playwright configuration

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:

wdio.conf.ts
services: [
[TestRelicService, {
includeDeviceLogs: true,
includeNetworkLogs: true,
screenshotOnEvery: 'failure',
}],
],
OptionTypeDefaultDescription
includeDeviceLogsbooleantrueCapture Android logcat / iOS syslog per test
includeNetworkLogsbooleantrueCapture HTTP network traffic
includeConsoleLogsbooleantrueCapture browser/app console output
includeScreenshotsbooleantrueCapture screenshots
screenshotOnEvery'test' | 'failure' | 'never''failure'When to capture screenshots
includeVideoRecordingbooleanfalseCapture screen video (performance impact)
includeCommandsbooleantrueCapture every WebDriver command with args and timing
includeAssertionsbooleantrueCapture assertion results
includeActionStepsbooleantrueCapture named action steps
deviceLogPollIntervalnumber1000Milliseconds between device log polls
preferBiDibooleantruePrefer 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:

wdio.conf.ts
reporters: [
'spec',
[TestRelicReporter, {
outputPath: './test-results/testrelic-timeline.json',
openReport: true,
cloud: {
apiKey: process.env.TESTRELIC_API_KEY,
},
}],
],

Core options

OptionTypeDefaultDescription
outputPathstring'./test-results/testrelic-timeline.json'Path for the JSON report file
htmlReportPathstringDerived from outputPath (.html extension)Path for the HTML report file
openReportbooleantrueOpen the HTML report in the browser after the run
testRunIdstringAuto-generated UUIDOverride the run ID — useful for correlating with CI build numbers
reportMode'streaming' | 'batched''streaming'How the reporter writes the JSON file
streamingThresholdnumber0Minimum number of tests before streaming kicks in
redactPatterns(string | RegExp)[]4 built-in patternsAdditional patterns to redact from output (appended to built-in patterns)
metadataRecord<string, unknown>undefinedCustom metadata attached to the report
quietbooleanfalseSuppress the console summary printed after the run
cloudCloudReporterOptionsundefinedCloud 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.

OptionTypeDefaultDescription
apiKeystringRequired. Your TestRelic API key
endpointstring'https://platform.testrelic.ai/api/v1'Cloud API endpoint (override for self-hosted)
uploadbooleantrueEnable/disable upload
timeoutnumber30000Upload request timeout in milliseconds
projectNamestringundefinedProject name tag attached to the run
uploadArtifactsbooleantrueUpload screenshots and video alongside the report
artifactMaxSizeMbnumber50Maximum total artifact size to upload (MB)
queueMaxAgenumber7Days to retain failed uploads in the local queue before discarding
queueDirectorystringSystem temp pathDirectory 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

Generate a full configuration with an AI assistant

AI Prompt — Full Appium production config
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.

AI Prompt — Minimal local-only config
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.

AI Prompt — Add redaction patterns
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.