I am having a separate integration test file for each screen and I want to run all the integration tests with a single command like “flutter tests”. I looked into the doc but was not able to find any way to do this. This also causes an issue with the firebase test lab apk. To create an android test apk I can only specify a single test file path to create the apk.
// flutter build generates files in android/ for building the app
flutter build apk
./gradlew app:assembleAndroidTest
./gradlew app:assembleDebug -Ptarget=integration_test/whattodo_tests.dart
For now, I found two workarounds for this.
Does anyone able to solve this issue or any better solution?
I have came across one project on GitHub has this kind of structure, I think which may help..
Make common file and import different files, folders or modules on that common file for testing
main.dart
import 'package:integration_test/integration_test.dart';
import 'about_us_page_test.dart' as about;
import 'add_label_page_test.dart' as label;
import 'add_project_page_test.dart' as project;
import 'add_task_page_test.dart' as tasks;
import 'completed_tasks_page_test.dart' as tasks_completed;
import 'home_page_test.dart' as home;
import 'whattodo_tests.dart' as whattodo;
void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
whattodo.main();
home.main();
tasks.main();
tasks_completed.main();
project.main();
label.main();
about.main();
}
to run all
these tests
flutter drive \
--driver=test_driver/integration_test_driver.dart \
--target=integration_test/main.dart
There is now a better way of doing it. Just use the test command like this.
To run all test
flutter test integration_test
To run a specific test
flutter test integration_test/app_test.dart
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.