Skip to content

Commit 5f06c09

Browse files
Explain more specifically how to use flutter drive/what it does (#161450)
_Run integration tests for the project_ is not an accurate statement, as there is nothing inherently about `flutter_driver` that is for integration tests (for example, it could be just plain automation, benchmarking, etc). In addition, clarifies what the most common two arguments might be and their defaults. Co-authored-by: Andrew Kolos <[email protected]>
1 parent 01fc232 commit 5f06c09

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

packages/flutter_tools/lib/src/commands/drive.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,11 @@ class DriveCommand extends RunCommandBase {
216216

217217
@override
218218
final String description =
219-
'Run integration tests for the project on an attached device or emulator.';
219+
'Builds and installs the app, and runs a Dart program that connects to '
220+
'the app, often to run externally facing integration tests, such as with '
221+
'package:test and package:flutter_driver.\n'
222+
'\n'
223+
'Usage: flutter drive --target <lib/main.dart> --driver <test_driver/main_test.dart>.';
220224

221225
@override
222226
String get category => FlutterCommandCategory.project;

packages/flutter_tools/test/commands.shard/hermetic/drive_test.dart

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,32 @@ void main() {
588588
DeviceManager: () => fakeDeviceManager,
589589
},
590590
);
591+
592+
testUsingContext('flutter drive --help explains how to use the command', () async {
593+
final DriveCommand command = DriveCommand(
594+
fileSystem: fileSystem,
595+
logger: logger,
596+
platform: platform,
597+
signals: signals,
598+
);
599+
600+
// TODO(matanlurey): https://github.com/flutter/flutter/issues/158532.
601+
final StringBuffer printOutput = StringBuffer();
602+
final Zone capturePrintZone = Zone.current.fork(
603+
specification: ZoneSpecification(
604+
print: (_, _, _, String line) {
605+
printOutput.writeln(line);
606+
},
607+
),
608+
);
609+
await capturePrintZone.run(() async {
610+
await createTestCommandRunner(command).run(<String>['drive', '--help']);
611+
});
612+
expect(
613+
printOutput.toString(),
614+
stringContainsInOrder(<String>['flutter drive', '--target', '--driver']),
615+
);
616+
});
591617
}
592618

593619
class ThrowingScreenshotDevice extends ScreenshotDevice {

0 commit comments

Comments
 (0)