Skip to main content

mobium test

Run *.test.json tests on the devices mobium.config.json names

Runs JSON test files: each test's steps are app_batch steps, its assertions app_wait_for steps and expects, run from a freshly launched app on each project's device. With no files, runs every *.test.json under the config's testDir. With MOBIUM_GRID set, each project leases a device of its own from the grid — by its platform, or its device — for the whole run. Exits 0 when every test passed — a flaky one passes and is listed — and 1 when any failed. See docs/guides/test-runner.md.

Usage​

mobium test [file or directory...] [flags]

Flags​

FlagTypeDefaultWhat it does
--configstringThe config to use (default: mobium.config.json here or above)
--debugboolStop before each step, show it and the screen, and wait: Enter steps, c continues, q quits
--grep -gstringRun only tests whose title (file › name) matches this regular expression
--last-failedboolRun only the tests that failed in the last run
--listboolList the tests that would run, and run nothing
--no-screenshotsboolKeep no screenshot of a failure — on a real phone it is somebody's screen
--openboolWith --ui, open the page in the browser
--outputstringWhere reports go (default: mobium-report beside the config)
--projectstringsRun only these projects, by name (repeat or comma-separate)
--reporterstrings[list]list, json, junit, html — comma-separate for several
--retriesintRun a failed test again this many times; a pass after a failure is flaky
--timeoutduration1m0sTime for each test
--tracestring"off"Keep a screenshot and the map after every step, and the test as a recording in Vibium's record format: on, off, or retain-on-failure
--uiboolServe a page on this machine to pick tests, run them and watch each step (docs/guides/test-runner.md)
--ui-portintWith --ui, the port on 127.0.0.1 (default: any free one)
--workersintHow many devices run at once; at most one per project (default: all)

And the global flags.

Examples​

Run the suite, and write the HTML report​

mobium test --reporter list,html

The HTML report of a run with a failure — from the test runner guide

The HTML report of a run with a failure — from the test runner guide

More, from mobium test --help​

mobium test # everything, every project
mobium test tests/login.test.json
mobium test -g "wrong password"
mobium test --project android --retries 2
mobium test --reporter list,junit,html && mobium show-report
mobium test --last-failed
mobium test --trace retain-on-failure --reporter list,html
mobium test --debug -g "wrong password" --project android
mobium test --ui --open # pick, run and watch tests on a page