@@ -6,14 +6,15 @@ and native Android instrumentation testing.
66
77## Usage
88
9- Add a dependency on the ` integration_test ` package in the
9+ Add a dependency on the ` integration_test ` and ` flutter_test ` package in the
1010` dev_dependencies ` section of pubspec.yaml. For plugins, do this in the
1111pubspec.yaml of the example app.
1212
1313Invoke ` IntegrationTestWidgetsFlutterBinding.ensureInitialized() ` at the start
1414of a test file, e.g.
1515
1616``` dart
17+ import 'package:flutter_test/flutter_test.dart';
1718import 'package:integration_test/integration_test.dart';
1819
1920void main() {
@@ -32,7 +33,7 @@ app code, it should go in `example/test/`. It is also acceptable to put
3233integration_test tests in ` test_driver/ ` folder so that they're alongside the
3334runner app (see below).
3435
35- ## Using Flutter driver to run tests
36+ ## Using Flutter Driver to Run Tests
3637
3738` IntegrationTestWidgetsTestBinding ` supports launching the on-device tests with
3839` flutter drive ` . Note that the tests don't use the ` FlutterDriver ` API, they
@@ -47,28 +48,27 @@ import 'dart:async';
4748import 'package:integration_test/integration_test_driver.dart';
4849
4950Future<void> main() async => integrationDriver();
50-
5151```
5252
5353To run a example app test with Flutter driver:
5454
55- ```
55+ ``` sh
5656cd example
5757flutter drive test/< package_name> _integration.dart
5858```
5959
6060To test plugin APIs using Flutter driver:
6161
62- ```
62+ ``` sh
6363cd example
64- flutter drive --driver=test_driver/<package_name>_test.dart test/<package_name>_e2e .dart
64+ flutter drive --driver=test_driver/< package_name> _test.dart test/< package_name> _integration_test .dart
6565```
6666
6767You can run tests on web in release or profile mode.
6868
6969First you need to make sure you have downloaded the driver for the browser.
7070
71- ```
71+ ``` sh
7272cd example
7373flutter drive -v --target=test_driver/< package_name> dart -d web-server --release --browser-name=chrome
7474```
@@ -84,7 +84,7 @@ this test file MainActivityTest.java or another name of your choice.
8484package com.example.myapp ;
8585
8686import androidx.test.rule.ActivityTestRule ;
87- import dev.flutter.plugins.e2e .FlutterTestRunner ;
87+ import dev.flutter.plugins.integration_test .FlutterTestRunner ;
8888import org.junit.Rule ;
8989import org.junit.runner.RunWith ;
9090
@@ -99,7 +99,7 @@ Update your application's **myapp/android/app/build.gradle** to make sure it
9999uses androidx's version of AndroidJUnitRunner and has androidx libraries as a
100100dependency.
101101
102- ```
102+ ``` gradle
103103android {
104104 ...
105105 defaultConfig {
@@ -117,10 +117,10 @@ dependencies {
117117}
118118```
119119
120- To e2e test on a local Android device (emulated or physical):
120+ To run a test on a local Android device (emulated or physical):
121121
122- ```
123- ./gradlew app:connectedAndroidTest -Ptarget=`pwd`/../test_driver/<package_name>_e2e .dart
122+ ``` sh
123+ ./gradlew app:connectedAndroidTest -Ptarget=` pwd` /../test_driver/< package_name> _integration_test .dart
124124```
125125
126126## Firebase Test Lab
@@ -130,7 +130,7 @@ the guides in the [Firebase test lab
130130documentation] ( https://firebase.google.com/docs/test-lab/?gclid=EAIaIQobChMIs5qVwqW25QIV8iCtBh3DrwyUEAAYASAAEgLFU_D_BwE )
131131to set up a project.
132132
133- To run an e2e test on Android devices using Firebase Test Lab, use gradle commands to build an
133+ To run a test on Android devices using Firebase Test Lab, use gradle commands to build an
134134instrumentation test for Android, after creating ` androidTest ` as suggested in the last section.
135135
136136``` bash
@@ -172,10 +172,10 @@ target 'Runner' do
172172end
173173```
174174
175- To e2e test on your iOS device (simulator or real), rebuild your iOS targets with Flutter tool.
175+ To run a test on your iOS device (simulator or real), rebuild your iOS targets with Flutter tool.
176176
177- ```
178- flutter build ios -t test_driver/<package_name>_e2e .dart (--simulator)
177+ ``` sh
178+ flutter build ios -t test_driver/< package_name> _integration_test .dart (--simulator)
179179```
180180
181181Open Xcode project (by default, it's ` ios/Runner.xcodeproj ` ). Create a test target
@@ -184,9 +184,9 @@ change the code. You can change `RunnerTests.m` to the name of your choice.
184184
185185``` objective-c
186186#import < XCTest/XCTest.h>
187- #import < e2e/E2EIosTest .h>
187+ #import < integration_test/IntegrationTestIosTest .h>
188188
189- E2E_IOS_RUNNER (RunnerTests)
189+ INTEGRATION_TEST_IOS_RUNNER (RunnerTests)
190190```
191191
192- Now you can start RunnerTests to kick out e2e tests!
192+ Now you can start RunnerTests to kick out integration tests!
0 commit comments