Skip to main content
Ask AI

Package Overview

testrelic-appium is distributed on PyPI and installs as a pytest plugin. This page explains how the pieces fit together.

Install

pip install testrelic-appium

To enable the mitmproxy network fallback, install the network-proxy extra:

pip install "testrelic-appium[network-proxy]"

pytest plugin and auto-wrap

The plugin registers through a pytest11 entry point, so it activates as soon as it is installed — no conftest.py changes required. For each test, it walks item.funcargs and wraps any appium.webdriver.webdriver.WebDriver instance it finds. Pure-Selenium tests carry no Appium driver, so they are never touched.

When you want explicit control over which driver is instrumented, two manual entry points are available:

  • testrelic_appium_driver fixture — request it in your test signature to receive an already-wrapped driver.
  • wrap_driver() function — wrap a driver you constructed yourself.

You can also disable auto-wrap entirely with the --testrelic-no-autowrap CLI flag.

Assertion API

Import assert_that to record a named assertion as a discrete event on the timeline:

from testrelic_appium import assert_that

with assert_that("toHaveText", expected="Welcome"):
assert el.text == "Welcome"

Bare assert statements are also picked up automatically — but only when they are not inside an assert_that block, so assertions are never double-counted.

CLI subcommands

The package installs a testrelic-appium command for working with reports and the offline queue:

CommandDescription
testrelic-appium versionPrint the installed version.
testrelic-appium merge shard-1.json shard-2.json -o merged.jsonMerge timeline shards (e.g. from parallel runs) into one file.
testrelic-appium serve ./test-results [--host 127.0.0.1] [--port 9323] [--open]Serve a report directory locally.
testrelic-appium drain [--queue-dir PATH]Flush the offline upload queue to the cloud.
testrelic-appium cleanup-queue [--queue-dir PATH] [--max-age-days 7]Remove stale entries from the offline queue.

The offline queue lives in .testrelic/queue/ by default.

Next steps