Skip to content

olef test

CLI v3.0.2View Markdown

Generated from Olef 3.0.2. All commands · Capabilities and requirements

These entries describe available commands, not a sequence to run. Check prerequisites before changing app, device, or cloud state. Global options are listed in the command catalog.

Run a command that needs the device’s single UiAutomation slot (instrumentation tests, uiautomator dump, android layout): disconnects Olef, runs the given command (stdio inherited), then reconnects (unless --no-reconnect). Exits with the command’s status

Terminal window
olef test --help

Output: passthrough_with_json_trailer.

Argument Description
--no-reconnect Leave Olef disconnected after the command finishes
<command> Required. The command to run, after --

Run test folders (each with a test.sh), or folders of them, one at a time per device. Each run gets its own folder (journal, failure report, report.html); the run writes JUnit XML, report.json and an index report.html, with flake classification when –repeat > 1. Exits non-zero when any repetition of a test still failed after its retries

Terminal window
olef test run --help

Output: json.

Argument Description
<paths> Test folders (with test.sh), folders of test folders, or scripts. Default: tests/olef
--repeat <REPEAT> Run every test this many times and classify each test and step as stable_pass, stable_fail or flaky Default: 1.
--retries <RETRIES> Rerun a failed test up to this many times; a pass after a retry is reported as flaky (JUnit <flakyFailure>), never as a plain pass Default: 0.
--env <KEY=VALUE> Set a script parameter (environment variable), e.g. --env CALLSIGN=Grace
--params <GLOB> Run each test once per data set: .env files matching this glob (relative to the test folder, else the working directory), each a list of KEY=VALUE lines
--capture <CAPTURE> Evidence per step: failures (default under test run), steps (a screenshot after every step, ~0.1 s each) or off Values: steps, failures, off.
--shard <I/N> Run only shard I of N (1-based) of the sorted test list, e.g. 2/4
--junit-out <FILE> Write JUnit XML here (default: <artifacts-dir>/junit.xml)
--artifacts-dir <DIR> Where run folders and reports go (default: .olef/test-runs/<timestamp>/)
--fail-fast Stop after the first test that fails (after its retries)
--timeout-ms <MS> Stop a script (and every command it started) that runs longer than this; the attempt fails with test_timeout Default: 900000.
--json Accepted for compatibility; output is always JSON.

Examples from the CLI (replace sample packages, selectors, and paths with your own):

Terminal window
olef test run tests/olef --repeat 10 --junit-out build/junit.xml
olef test run tests/olef/mission_recovery --retries 1 --env CALLSIGN=Grace

Build JUnit XML and a flake report from run folders left by direct bash test.sh runs or by test run

Terminal window
olef test report --help

Output: json.

Argument Description
<runs> Required. Run folders, or folders holding them (a test run artifacts folder)
--junit-out <FILE> Write JUnit XML here
--json Include the whole report (every run and step) in the output
--baseline <RUN> Flag steps that got slower than in this earlier run folder (or test run artifacts folder)

Examples from the CLI (replace sample packages, selectors, and paths with your own):

Terminal window
olef test report .olef/sessions --junit-out junit.xml

Check scripts for coordinates, text-only selectors, missing checks, sleeps, missing set -euo pipefail or trap, unquoted parameters, secrets in literal text, Bash 4 features and custom code. Exits non-zero on errors

Terminal window
olef test lint --help

Output: json.

Argument Description
<paths> Test folders, folders of test folders, or scripts. Default: tests/olef
--json Accepted for compatibility; output is always JSON.

Examples from the CLI (replace sample packages, selectors, and paths with your own):

Terminal window
olef test lint tests/olef

Print a script’s parameters, steps and commands as read back (argv lists for other tools), without running it

Terminal window
olef test show --help

Output: json.

Argument Description
<script> Required. The script (test.sh) or its test folder
--json Print JSON (the default output is plain text)

Examples from the CLI (replace sample packages, selectors, and paths with your own):

Terminal window
olef test show tests/olef/mission_recovery/test.sh --json

Propose a one-line patch for a failed run (a selector from the failure’s closest candidates, or a changed expectation to confirm). Never edits the script

Terminal window
olef test heal --help

Output: json.

Argument Description
<test> Required. The test folder (with test.sh) or the script
--from <RUN_FOLDER> Required. The failed run folder to heal from
--out <FILE> / -o Write the patch here (default: <run-folder>/heal.patch)
--json Accepted for compatibility; output is always JSON.

Examples from the CLI (replace sample packages, selectors, and paths with your own):

Terminal window
olef test heal tests/olef/mission_recovery --from .olef/test-runs/run-1/mission_recovery/r001-a1