TapTest

@Target(allowedTargets = [AnnotationTarget.CLASS])
@ExtendWith(value = [TapExtension::class])
annotation class TapTest(val deviceLifetime: DeviceLifetime = DeviceLifetime.PER_TEST)(source)

Enables Tap for a test class: one driver session per declared role is opened before each test and closed (with failure artifacts captured first) after it.

Configuration comes from JVM system properties (Gradle: systemProperty(...) on the test task) or TAP_* environment variables:

PropertyMeaning
tap.serialsserials roles map to, in order from a start device that rotates per test (optional; default any pool device)
tap.device.<role>pin a role to one serial (optional)
tap.artifactsDirfailure artifacts root (default build/tap-artifacts)
tap.captureonFailure (default) = Device.capture() every device of a failed test into the artifacts root; off = capture nothing
tap.acquireTimeoutSecondshow long to wait for a device another session holds (default 300)
tap.serverhost:port of a running server (default: the one tap start recorded in the state dir)
tap.tokenbearer token for an explicit tap.server (default: the one in the state dir's daemon.json)
tap.manageDaemontrue = run tap start before the first test and tap stop after the last one if that start created the daemon (default false: a daemon must already be running)
tap.binthe tap executable tap.manageDaemon uses (default TAP_BIN or tap on PATH)

Sessions come from the host server (tap start), which owns ADB, the driver and the machine-wide device pool; the driver APKs ship inside the daemon. Devices are attached per test unless deviceLifetime is DeviceLifetime.PER_CLASS.

Properties

Link copied to clipboard

How long an attached device lives; see DeviceLifetime.