Commands - build

Synopsis

Build app binaries for integration testing.

patrol build android
patrol build ios

To see all available options and flags, run patrol build android --help or patrol build ios --help.

For patrol build to work, you must complete native setup.

Description

patrol build is useful if you want to run test on CI, for example on Firebase Test Lab. It works the same as patrol test, except that it does run tests.

patrol build builds apps in debug mode by default.

To run tests on a physical iOS device on a device farm, the apps have to be built in release mode. To do so, pass the --release flag.

Examples

To build a single test for Android in debug mode

patrol build android --target integration_test/example_test.dart

or alternatively (but redundantly):

patrol build android --target integration_test/example_test.dart --debug

To build all tests for Android in debug mode

patrol build android

To build a single test for iOS device in release mode

patrol build ios --target integration_test/example_test.dart --release

To build a single test for iOS simulator in debug mode

patrol build ios --target integration_test/example_test.dart --debug

Under the hood

The patrol build command walks through hierarchy of the integration_test directory and finds all files that end with _test.dart, and then creates an additional "test bundle" file that references all the tests it found. Thanks to this, all tests are built into a single app binary - only a single build is required, which greatly reduces time spent on building. Then, it runs a new app process for every test, improving isolation between tests and enabling sharding.

We call this feature advanced test bundling. It provides deep and seamless integration with existing Android and iOS testing tools. It also fixes some long-standing Flutter issues:

We think that this is huge (even though it may not look like it at first glance). To learn more, read the in-depth technical article explaining the nuts and bolts.