[英]How to do multiple files of integration tests in flutter 2?
I'm trying to create an integration test for my Flutter app with new integration_test package: https://github.com/flutter/flutter/tree/master/packages/integration_test#integration_test我正在尝试使用新的 integration_test 包为我的 Flutter 应用程序创建集成测试: https : //github.com/flutter/flutter/tree/master/packages/integration_test#integration_test
I have multiple files of integration tests, like:我有多个集成测试文件,例如:
integration_test/
login_test.dart
logout_test.dart
run_all_test.dart
test_driver/
integration_test.dart
I want to run the login and logout tests sequentially, using the run_all_test.dart我想使用 run_all_test.dart 按顺序运行登录和注销测试
In run_all_test.dart script I have:在 run_all_test.dart 脚本中,我有:
void main() {
final binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized() as
IntegrationTestWidgetsFlutterBinding;
binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive;
app.main();
group('All tests', () {
loginTest();
logoutTest();
});
and login_test.dart is like this (logout_test.dart is the same):而 login_test.dart 是这样的(logout_test.dart 也是这样):
void main() {
loginTest();
}
Future<void> loginTest() async {
group('Login - ', (){
testWidgets("Login test", (WidgetTester tester) async {
await ...
});
});
}
Now, login works perfectly and, when he is done, starts the logout test but, at this moment, the app is waiting with the message "Test starting .." and then fails.现在,登录工作完美,当他完成后,开始注销测试,但此时,应用程序正在等待消息“测试开始......”然后失败。
With the old package, everything worked perfectly and, between one test and another, the app was not restarted.使用旧包,一切正常,并且在一次测试和另一次测试之间,应用程序没有重新启动。
I solved adding:我解决了添加:
await tester.pumpFrames(app.MyApp(), Duration(seconds: 3));
in all test files.在所有测试文件中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.