This repository has been archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[e2e] update README #2233
Merged
Merged
[e2e] update README #2233
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
## 0.2.1+1 | ||
|
||
* Updated README. | ||
|
||
## 0.2.1 | ||
|
||
* Support the v2 Android embedder. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# e2e | ||
|
||
This package enables self-driving testing of Flutter code on devices and emulators. | ||
It can adapt the test results in a format that is compatible with `flutter drive` | ||
It adapts flutter_test results into a format that is compatible with `flutter drive` | ||
and native Android instrumentation testing. | ||
|
||
iOS support is not available yet, but is planned in the future. | ||
|
@@ -27,12 +27,19 @@ void main() { | |
} | ||
``` | ||
|
||
## Test locations | ||
|
||
It is recommended to put e2e tests in the `test/` folder of the app or package. | ||
For example apps, if the e2e test references example app code, it should go in | ||
`example/test/`. It is also acceptable to put e2e tests in `test_driver/` folder | ||
so that they're alongside the runner app (see below). | ||
|
||
## Using Flutter driver to run tests | ||
|
||
`E2EWidgetsTestBinding` supports launching the on-device tests with `flutter drive`. | ||
Note that the tests don't use the `FlutterDriver` API, they use `testWidgets` instead. | ||
|
||
Put the a file named `<package_name>_test.dart` in the app' `test_driver` directory: | ||
Put the a file named `<package_name>_e2e_test.dart` in the app' `test_driver` directory: | ||
|
||
``` | ||
import 'package:flutter_driver/flutter_driver.dart'; | ||
|
@@ -106,22 +113,27 @@ dependencies { | |
To e2e test on a local Android device (emulated or physical): | ||
|
||
``` | ||
./gradlew connectedAndroidTest -Ptarget=`pwd`/../test_driver/<package_name>_e2e.dart | ||
./gradlew app:connectedAndroidTest -Ptarget=`pwd`/../test_driver/<package_name>_e2e.dart | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The suffix should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The suffix here should be _e2e.dart. The _e2e_test.dart suffix is reserved for the driver runner (which I hope will be unnecessary in the future). |
||
``` | ||
|
||
## Firebase Test Lab | ||
|
||
If this is you first time testing with Firebase Test Lab, | ||
you'll need to follow the guides in the | ||
[Firebase test lab documentation](https://firebase.google.com/docs/test-lab/?gclid=EAIaIQobChMIs5qVwqW25QIV8iCtBh3DrwyUEAAYASAAEgLFU_D_BwE) | ||
to set up a project. | ||
|
||
To run an e2e test on Android devices using Firebase Test Lab, use gradle commands to build an | ||
instrumentation test for Android. | ||
|
||
``` | ||
pushd android | ||
./gradlew assembleAndroidTest | ||
./gradlew assembleDebug -Ptarget=<path_to_test>.dart | ||
./gradlew app:assembleAndroidTest | ||
./gradlew app:assembleDebug -Ptarget=<path_to_test>.dart | ||
popd | ||
``` | ||
|
||
Upload to Firebase Test Lab, making sure to replace <PATH_TO_KEY_FILE>, | ||
Upload the build apks Firebase Test Lab, making sure to replace <PATH_TO_KEY_FILE>, | ||
<PROJECT_NAME>, <RESULTS_BUCKET>, and <RESULTS_DIRECTORY> with your values. | ||
|
||
``` | ||
|
@@ -135,4 +147,8 @@ gcloud firebase test android run --type instrumentation \ | |
--results-dir=<RESULTS_DIRECTORY> | ||
``` | ||
|
||
You can pass additional parameters on the command line, such as the | ||
devices you want to test on. See | ||
[gcloud firebase test android run](https://cloud.google.com/sdk/gcloud/reference/firebase/test/android/run). | ||
|
||
iOS support for Firebase Test Lab is not yet available, but is planned. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does
flutter test
scans_test.dart
in a directory and execute them?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. It only looks in the test/ directory by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then when executing
flutter test
without an attached device, the_e2e_test.dart
will execute. Is it expected?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flutter test
only looks for tests in the test/ folder. test_driver/ is ignored.