Writing tests for the Flutter app
For the sake of consistency, we generally recommend keeping the same file organization in both the lib
and test
folders. This will guarantee a better mental order and allow you to quickly search for the tests when you need to work on them.
To get started, let’s create the main_test.dart
file in the test
folder and ensure it has the following contents:
import 'package:chapter_1/main.dart' as app_main; void main() { group('Testing the root widget', () { testWidgets( “Making sure that 'main()' doesn't throw”, (tester) async { var throws = false; try { app_main.main(); } catch...