concept Flutter driver in category flutter

This is an excerpt from Manning's book Flutter in Action.
This is done with the flutter_driver package. Tests with Flutter driver are written similarly to widget tests, but the package is really made to simulate a user. Driver tests actually run the app and then interact with it. You can watch it scroll through your app and tap buttons that you’ve described. If you’ve used something like Selenium Driver before, this is similar. If you haven’t, prepare to be wowed.
The tests are in the test_app.dart file. Again, the tests aren’t too different. You use Finders (though they’re called slightly differently), Matchers, and the same expect calls. The difference mainly lies in the setup. You have access to special functions that are used to connect to the Flutter driver. The setup is shown in the next listing.
Listing 11.15. Writing flutter_driver integration tests
// backend/test_drive/app.dart import 'package:flutter_driver/flutter_driver.dart'; import 'package:test/test.dart'; #1 void main() { group("Todo App", () { final buttonFinder = find.byValueKey("get-todos-button"); #2 final completedTodoCounter = find.byValueKey("counter"); final listViewFinder = find.byValueKey("list-view"); final lastTodoFinder = find.byValueKey("todo-19"); final lastTodoSubtitleFinder = find.byValueKey('todo-19-subtitle'); FlutterDriver driver; #3 // Connect to the Flutter driver before running any tests setUpAll(() async { #4 driver = await FlutterDriver.connect(); }); // Close the connection to the driver after the tests have completed tearDownAll(() async { #5 if (driver != null) { driver.close(); } });