Configuration
testrelic-appium is configured through pyproject.toml, command-line flags, and environment variables. Most teams set defaults in pyproject.toml and override per-run from the CLI.
testrelic_options in pyproject.toml
Set options under [tool.pytest.ini_options] using the testrelic_options list:
[tool.pytest.ini_options]
testrelic_options = [
"outputPath=./test-results/testrelic-timeline.json",
"screenshotOnEvery=on-failure",
"includeNetworkLogs=true",
]
Option reference
| Key | Type | Default | Description |
|---|---|---|---|
outputPath | str | ./test-results/testrelic-timeline.json | Where the JSON timeline is written. |
htmlReportPath | str | derived | Where the HTML report is written (derived from outputPath when unset). |
openReport | bool | false | Open the HTML report automatically after the run. |
includeDeviceLogs | bool | true | Capture Android logcat / iOS syslog + crashlog. |
includeNetworkLogs | bool | true | Capture HTTP requests/responses. |
includeConsoleLogs | bool | true | Capture webview/browser console output. |
includeScreenshots | bool | true | Capture screenshots. |
screenshotOnEvery | off | on | on-failure | on-every-step | on-failure | Screenshot policy. |
includeVideoRecording | bool | false | Record device video. |
includeCommands | bool | true | Record every Appium/WebDriver command. |
includeAssertions | bool | true | Record assertions. |
deviceLogPollInterval | int (ms) | 1000 (min 100) | Background poll interval for device logs. |
maxDeviceLogMb | int | 20 | Cap on captured device-log size. |
preferBiDi | bool | true | Try BiDi log.entryAdded before falling back to polling. |
redactPatterns | list[str] | [] | Extra patterns to redact from the timeline. |
quiet | bool | false | Reduce console output. |
metadata | dict | null | Arbitrary metadata attached to the run. |
cloud | object | — | Cloud upload configuration. |
CLI flags
Override behavior per-run from the pytest command line:
| Flag | Description |
|---|---|
--testrelic-output PATH | Override the timeline output path. |
--testrelic-disable | Disable the plugin for this run. |
--testrelic-quiet | Reduce console output. |
--testrelic-no-autowrap | Do not auto-wrap drivers found in fixtures. |
Environment variables
| Variable | Purpose |
|---|---|
TESTRELIC_API_KEY | API key for cloud uploads. |
TESTRELIC_CLOUD_ENDPOINT | Cloud endpoint (default https://platform.testrelic.ai/api/v1). |
TESTRELIC_UPLOAD_STRATEGY | How and when timelines upload. |
TESTRELIC_CLOUD_TIMEOUT | Upload request timeout. |
TESTRELIC_RUN_TYPE | Tag the run type for the workspace. |
Screenshot and video policy
screenshotOnEvery controls when screenshots are taken:
off— never.on— capture on test boundaries.on-failure— capture when a test fails (the default).on-every-step— capture after every command (verbose; useful for debugging).
Video is opt-in via includeVideoRecording=true. Recording uses Appium screen recording first, falling back to adb screenrecord.
Device logs and network capture
- Device logs (
includeDeviceLogs) are polled in the background everydeviceLogPollIntervalms and sliced per test, capped atmaxDeviceLogMb. - Network capture (
includeNetworkLogs) uses Chrome DevTools Protocol performance logs on Android and safariNetwork on iOS. - Console logs (
includeConsoleLogs) prefer WebDriver BiDilog.entryAddedwhenpreferBiDi=true, falling back to polling.
When CDP/safariNetwork capture is not available, an optional mitmproxy fallback can record network traffic. Install it with the network-proxy extra:
pip install "testrelic-appium[network-proxy]"
Redaction
The timeline redacts sensitive data, including Appium-specific command arguments for elementSendKeys, setValueImmediate, and replaceValue. Add your own patterns with redactPatterns:
[tool.pytest.ini_options]
testrelic_options = [
"redactPatterns=['Bearer\\\\s+\\\\w+', '\\\\d{16}']",
]