Skip to main content
Ask AI

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:

pyproject.toml
[tool.pytest.ini_options]
testrelic_options = [
"outputPath=./test-results/testrelic-timeline.json",
"screenshotOnEvery=on-failure",
"includeNetworkLogs=true",
]

Option reference

KeyTypeDefaultDescription
outputPathstr./test-results/testrelic-timeline.jsonWhere the JSON timeline is written.
htmlReportPathstrderivedWhere the HTML report is written (derived from outputPath when unset).
openReportboolfalseOpen the HTML report automatically after the run.
includeDeviceLogsbooltrueCapture Android logcat / iOS syslog + crashlog.
includeNetworkLogsbooltrueCapture HTTP requests/responses.
includeConsoleLogsbooltrueCapture webview/browser console output.
includeScreenshotsbooltrueCapture screenshots.
screenshotOnEveryoff | on | on-failure | on-every-stepon-failureScreenshot policy.
includeVideoRecordingboolfalseRecord device video.
includeCommandsbooltrueRecord every Appium/WebDriver command.
includeAssertionsbooltrueRecord assertions.
deviceLogPollIntervalint (ms)1000 (min 100)Background poll interval for device logs.
maxDeviceLogMbint20Cap on captured device-log size.
preferBiDibooltrueTry BiDi log.entryAdded before falling back to polling.
redactPatternslist[str][]Extra patterns to redact from the timeline.
quietboolfalseReduce console output.
metadatadictnullArbitrary metadata attached to the run.
cloudobjectCloud upload configuration.

CLI flags

Override behavior per-run from the pytest command line:

FlagDescription
--testrelic-output PATHOverride the timeline output path.
--testrelic-disableDisable the plugin for this run.
--testrelic-quietReduce console output.
--testrelic-no-autowrapDo not auto-wrap drivers found in fixtures.

Environment variables

VariablePurpose
TESTRELIC_API_KEYAPI key for cloud uploads.
TESTRELIC_CLOUD_ENDPOINTCloud endpoint (default https://platform.testrelic.ai/api/v1).
TESTRELIC_UPLOAD_STRATEGYHow and when timelines upload.
TESTRELIC_CLOUD_TIMEOUTUpload request timeout.
TESTRELIC_RUN_TYPETag 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 every deviceLogPollInterval ms and sliced per test, capped at maxDeviceLogMb.
  • Network capture (includeNetworkLogs) uses Chrome DevTools Protocol performance logs on Android and safariNetwork on iOS.
  • Console logs (includeConsoleLogs) prefer WebDriver BiDi log.entryAdded when preferBiDi=true, falling back to polling.
mitmproxy fallback

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:

pyproject.toml
[tool.pytest.ini_options]
testrelic_options = [
"redactPatterns=['Bearer\\\\s+\\\\w+', '\\\\d{16}']",
]

Next steps