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
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#
patrol build command walks through hierarchy of the
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.