A Flutter project demonstrating how to write native E2E tests for a Flutter app
- Switch current directory to
android
- run
./gradlew app:connectedAndroidTest -Ptarget=
pwd/../test_driver/example.dart
- Switch current directory to
ios
- run `xcodebuild test -workspace Runner.xcworkspace -scheme Runner -destination 'platform=iOS Simulator,name=iPhone 13'
Note: Custom location for iOS tests can be set only manually in running simulator. It can't be achieved through CLI.
- Right click on
android
directory ->Flutter
->Open Android module in Android Studio
- In
android/app/src
addandroidTest
directory - Under
androidTest
, addjava
orkotlin
directory (depending on selected language to write the tests) - Under directory from 3., add a new package with name reflecting your app's package
- Add first test file, e.g.
MainActivityTest.java
- Right click on
ios
directory ->Flutter
->Open iOS module in Xcode
- In Xcode, select top level
Runner
entry (forRunner.xcodeproj
), selectGeneral
tab and click on+
button underTARGETS
- Search for
UI Testing Bundle
, then select it and clickNext
- Set Product Name to
RunnerUITests
and Organization Identifier to your app's identifier - Click
Finish