Skip to content

Commit eb4af2e

Browse files
authored
[integration_test] Test drivers should end with _test.dart (flutter#3063)
This makes globbing by tooling easier. Also fix the documentation for running them natively with the Android and iOS tool.
1 parent 861eae9 commit eb4af2e

File tree

7 files changed

+25
-13
lines changed

7 files changed

+25
-13
lines changed

.cirrus.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ task:
5959
- ./chromedriver/chromedriver --port=4444 &
6060
test_script:
6161
- cd $INTEGRATION_TEST_PATH/example/
62-
- flutter drive -v --driver=test_driver/integration_test_driver.dart --target=integration_test/example_test.dart -d web-server --release --browser-name=chrome
62+
- flutter drive -v --driver=test_driver/integration_test.dart --target=integration_test/example_test.dart -d web-server --release --browser-name=chrome
6363
- name: build-apks+java-test+firebase-test-lab
6464
env:
6565
matrix:

packages/integration_test/README.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ void main() {
3030
### Driver Entrypoint
3131

3232
An accompanying driver script will be needed that can be shared across all
33-
integration tests. Create a `integration_test_driver.dart` in the `test_driver/`
34-
directory with the following contents:
33+
integration tests. Create a file named `integration_test.dart` in the
34+
`test_driver/` directory with the following contents:
3535

3636
```dart
3737
import 'package:integration_test/integration_test_driver.dart';
@@ -57,7 +57,7 @@ integration_test/
5757
test/
5858
# Other unit tests go here.
5959
test_driver/
60-
integration_test_driver.dart
60+
integration_test.dart
6161
```
6262

6363
[Example](https://github.com/flutter/plugins/tree/master/packages/integration_test/example)
@@ -67,11 +67,11 @@ test_driver/
6767
These tests can be launched with the `flutter drive` command.
6868

6969
To run the `integration_test/foo_test.dart` test with the
70-
`test_driver/integration_test_driver.dart` driver, use the following command:
70+
`test_driver/integration_test.dart` driver, use the following command:
7171

7272
```sh
7373
flutter drive \
74-
--driver=test_driver/integration_test_driver.dart \
74+
--driver=test_driver/integration_test.dart \
7575
--target=integration_test/foo_test.dart
7676
```
7777

@@ -85,7 +85,7 @@ Use following command to execute the tests:
8585

8686
```sh
8787
flutter drive \
88-
--driver=test_driver/integration_test_driver.dart \
88+
--driver=test_driver/integration_test.dart \
8989
--target=integration_test/foo_test.dart \
9090
-d web-server
9191
```
@@ -134,10 +134,11 @@ dependencies {
134134
}
135135
```
136136

137-
To run a test on a local Android device (emulated or physical):
137+
To run `integration_test/foo_test.dart` on a local Android device (emulated or
138+
physical):
138139

139140
```sh
140-
./gradlew app:connectedAndroidTest -Ptarget=`pwd`/../test_driver/<package_name>_integration_test.dart
141+
./gradlew app:connectedAndroidTest -Ptarget=`pwd`/../integration_test/foo_test.dart
141142
```
142143

143144
## Firebase Test Lab
@@ -189,10 +190,12 @@ target 'Runner' do
189190
end
190191
```
191192

192-
To run a test on your iOS device (simulator or real), rebuild your iOS targets with Flutter tool.
193+
To run `integration_test/foo_test.dart` on your iOS device, rebuild your iOS
194+
targets with Flutter tool.
193195

194196
```sh
195-
flutter build ios -t test_driver/<package_name>_integration_test.dart (--simulator)
197+
# Pass --simulator if building for the simulator.
198+
flutter build ios integration_test/foo_test.dart
196199
```
197200

198201
Open Xcode project (by default, it's `ios/Runner.xcodeproj`). Create a test target

packages/integration_test/example/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ Android / iOS:
88

99
```sh
1010
flutter drive \
11-
--driver=test_driver/integration_test_driver.dart \
11+
--driver=test_driver/integration_test.dart \
1212
--target=integration_test/example_test.dart
1313
```
1414

1515
Web:
1616

1717
```sh
1818
flutter drive \
19-
--driver=test_driver/integration_test_driver.dart \
19+
--driver=test_driver/integration_test.dart \
2020
--target=integration_test/example_test.dart \
2121
-d web-server
2222
```

packages/integration_test/example/test_driver/integration_test_extended_driver.dart renamed to packages/integration_test/example/test_driver/extended_integration_test.dart

File renamed without changes.

packages/integration_test/example/integration_test/failure_test.dart renamed to packages/integration_test/example/test_driver/failure.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ import 'package:integration_test/integration_test.dart';
88

99
import 'package:integration_test_example/main.dart' as app;
1010

11+
/// This file is placed in `test_driver/` instead of `integration_test/`, so
12+
/// that the CI tooling of flutter/plugins only uses this together with
13+
/// `failure_test.dart` as the driver. It is only used for testing of
14+
/// `package:integration_test` – do not follow the conventions here if you are a
15+
/// user of `package:integration_test`.
16+
1117
// Tests the failure behavior of the IntegrationTestWidgetsFlutterBinding
1218
//
1319
// This test fails intentionally! It should be run using a test runner that

packages/integration_test/example/test_driver/integration_test_failure_driver.dart renamed to packages/integration_test/example/test_driver/failure_test.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import 'package:flutter_driver/flutter_driver.dart';
22
import 'package:integration_test/common.dart' as common;
33
import 'package:test/test.dart';
44

5+
/// This file is only used for testing of `package:integration_test` – do not
6+
/// follow the conventions here if you are a user of `package:integration_test`.
7+
58
Future<void> main() async {
69
test('fails gracefully', () async {
710
final FlutterDriver driver = await FlutterDriver.connect();

packages/integration_test/example/test_driver/integration_test_driver.dart renamed to packages/integration_test/example/test_driver/integration_test.dart

File renamed without changes.

0 commit comments

Comments
 (0)