Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 41 additions & 13 deletions src/content/cookbook/testing/integration/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,38 @@ To perform these tasks, use *integration tests*.
Integration tests verify the behavior of the complete app.
This test can also be called end-to-end testing or GUI testing.

The Flutter SDK includes the [integration_test][] package.
## Testing frameworks

Flutter supports two main approaches for integration testing:

### `integration_test` package

The Flutter SDK includes the [`integration_test`][integration_test] package.
Tests written with `integration_test` can perform the following tasks:

* Run on the target device.
To test multiple Android or iOS devices, use Firebase Test Lab.
* Run from the host machine with `flutter test integration_test`.
* Use `flutter_test` APIs. This makes integration tests
similar to writing [widget tests][].

However, `integration_test` can't interact with native platform UI,
such as permission dialogs, notifications, or the contents of
platform views.

### `patrol` package

[Patrol][] is an open-source testing framework that builds on top
of Flutter's testing capabilities. It extends `integration_test`
with native interaction support. Patrol lets you:

* Interact with native platform UI, such as permission dialogs,
notifications, and WebViews.
* Access device-level features like toggling Wi-Fi
or adjusting system settings.
* Write more concise tests using [patrol finders][].

To learn more, visit the [Patrol documentation][].

## Terminology

Expand All @@ -30,30 +61,27 @@ The Flutter SDK includes the [integration_test][] package.
If you run your app in a web browser or as a desktop application,
the host machine and the target device are the same.

## Dependent package
## Getting started

To run integration tests, add the `integration_test` package
as a dependency for your Flutter app test file.
To use `integration_test`, add it as a dependency for your
Flutter app test file.

To migrate existing projects that use `flutter_driver`,
consult the [Migrating from flutter_driver][] guide.

Tests written with the `integration_test` package
can perform the following tasks.

* Run on the target device.
To test multiple Android or iOS devices, use Firebase Test Lab.
* Run from the host machine with `flutter test integration_test`.
* Use `flutter_test` APIs. This makes integration tests
similar to writing [widget tests][].
To use Patrol, follow the [Patrol setup guide][].

## Use cases for integration testing

The other guides in this section explain how to use integration tests to validate
[functionality][] and [performance][].

[patrol finders]: {{site.pub-pkg}}/patrol_finders
[functionality]: /testing/integration-tests/
[performance]: /cookbook/testing/integration/profiling/
[integration_test]: {{site.repo.flutter}}/tree/main/packages/integration_test
[Migrating from flutter_driver]: /release/breaking-changes/flutter-driver-migration
[Patrol]: {{site.pub-pkg}}/patrol
[Patrol documentation]: https://patrol.leancode.co/
[Patrol setup guide]: https://patrol.leancode.co/getting-started
[performance]: /cookbook/testing/integration/profiling/
[widget tests]: /testing/overview#widget-tests
16 changes: 15 additions & 1 deletion src/content/testing/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,24 @@ such as iOS Simulator or Android Emulator.
The app under test is typically isolated
from the test driver code to avoid skewing the results.

The Flutter SDK includes the [`integration_test`][] package.
However, this package can't interact with native platform UI,
such as permission dialogs, notifications, or platform views.
For apps that need native interactions, you can use [Patrol][],
an open-source framework that extends Flutter's testing
capabilities with native platform support.

For more information on how to write integration tests, see the [integration
testing page][].

[`integration_test`]: {{site.repo.flutter}}/tree/main/packages/integration_test
[Patrol]: {{site.pub-pkg}}/patrol

### Recipes {:.no_toc}

- [Integration testing concepts](/cookbook/testing/integration/introduction)
- [Write and run an integration test](/testing/integration-tests)
- [Write and run a Patrol test](/testing/patrol-tests)
- [Measure performance with an integration test](/cookbook/testing/integration/profiling)

## Continuous integration services
Expand All @@ -119,13 +131,15 @@ integration services, see the following:
* [Test Flutter apps on Travis][]
* [Test Flutter apps on Cirrus][]
* [Codemagic CI/CD for Flutter][]
* [Codemagic CI/CD for Patrol][]
* [Flutter CI/CD with Bitrise][]

[code coverage]: https://en.wikipedia.org/wiki/Code_coverage
[Codemagic CI/CD for Flutter]: https://blog.codemagic.io/getting-started-with-codemagic/
[Codemagic CI/CD for Patrol]: https://docs.codemagic.io/integrations/patrol-integration/
[Continuous delivery using fastlane with Flutter]: /deployment/cd#fastlane
[Flutter CI/CD with Bitrise]: https://devcenter.bitrise.io/en/getting-started/quick-start-guides/getting-started-with-flutter-apps
[Test Flutter apps on Appcircle]: https://blog.appcircle.io/article/flutter-ci-cd-github-ios-android-web#
[Test Flutter apps on Cirrus]: https://cirrus-ci.org/examples/#flutter
[Test Flutter apps on Travis]: {{site.flutter-blog}}/test-flutter-apps-on-travis-3fd5142ecd8c
[integration testing page]: /testing/integration-tests
[integration testing page]: /cookbook/testing/integration/introduction
Loading