testing_app/README.md
A Sample app that shows different types of testing in Flutter.
This particular sample uses the Provider package but any other state management approach would do.
Show how to perform:
The Flutter SDK can run unit tests and widget tests in a virtual machine, without the need of a physical device or emulator.
test/ directory in one go, run flutter test.flutter test test/<file_path>flutter run test/<file_path>flutter test integration_test to run all the integration tests with a single command.flutter drive --driver=integration_test/driver.dart --target=integration_test/app_test.dart to run them separately. You can also provide custom driver files with this command.flutter drive --driver=integration_test/perf_driver.dart --target=integration_test/perf_test.dart --profile --trace-startup
--trace-startup option is used to avoid flushing older timeline events when the timeline gets long.flutter drive --driver=integration_test/driver.dart --target=integration_test/state_mgmt_test.dartlcov tool:
brew install lcovsudo apt install lcovflutter test --coveragelcov.info into readable html:
genhtml coverage/lcov.info -o coverage/indexcoverage/index/index.html in your preferred browser.Note that tools like GitHub Actions can't run tests on a physical device, which is required to run integration tests. Instead, you can use Firebase Test Lab, Codemagic or any platform of your choice to do that.
If you have a general question about testing in Flutter, the best places to go are:
If you run into an issue with the sample itself, please file an issue.