Tests using integration_test
have incorrect duration when run natively
#117386
Labels
f: integration_test
The flutter/packages/integration_test plugin
found in release: 3.3
Found to occur in 3.3
found in release: 3.7
Found to occur in 3.7
framework
flutter/packages/flutter repository. See also f: labels.
has reproducible steps
The issue has been confirmed reproducible and is ready to work on
P2
Important issues not at the top of the work list
team-framework
Owned by Framework team
triaged-framework
Triaged by Framework team
Steps to reproduce
Clone the bartekpacia/flutter_integration_test_duration_bug repository. This is a default counter app slightly modified by me to demonstrate this problem.
cd
to the cloned repository.$ flutter pub get
$ cd android
Run Flutter integration test natively:
$ ./gradlew app:connectedDebugAndroidTest -Ptarget=$(pwd)/../integration_test/app_test.dart
Open the test summary generated by Gradle:
The same problem occurs when running tests on iOS. Refer to integration_test's README to learn how to run tests on iOS.
Expected results:
I expect the test duration to be correct.
The
integration_test/app_test.dart
that was run callstester.pump(Duration(seconds: 3));
twice, so the duration should not be shorter than at least 6 seconds.Actual results:
Test duration is very short, on my machine it usually revolves around ~300ms.
More details
This problem is caused by how Dart test results are submitted to the native side, and how native test cases are created from these Dart test results.
Currently
IntegrationTestWidgetsFlutterBinding
submits Dart test results to the native side after all Dart tests have been executed. When the native side receives these results, it creates native test cases (Android implementation, iOS implementation). But these test cases are simply stubs – their execution is finished immediately after creation. That's why the runtime of these testcases is so very short.A solution that comes to my mind would do the following:
Logs
The text was updated successfully, but these errors were encountered: