简体   繁体   中英

Flutter integration tests won't run

I am trying to write some integration tests using the flutter driver based off of the example here: https://flutter.io/testing/ . I am able to get the app to deploy, but all I get back is awaiting for app response. I'm really not sure what else to do as it just sits and waits. Here's what I see in the terminal.

 flutter drive --target=test_driver/home_category_list_scroll.dart
 Using device Sampson's iPhone.
 Starting application: test_driver/home_category_list_scroll.dart
 Automatically signing iOS for device deployment using specified 
 development team in Xcode project: QDCF25JLN2
 Running pod install...                                       7.2s
 Starting Xcode build...                                          
 ├─Assembling Flutter resources...                   13.0s
 └─Compiling, linking and signing...                  7.5s
 Xcode build done.                                           27.6s
 Installing and launching...                                      
 flutter: Observatory listening on http://127.0.0.1:54774/
 00:00 +0: scrolling performance test (setUpAll)
 [info ] FlutterDriver: Connecting to Flutter application at 
 http://127.0.0.1:54270
 [info ] FlutterDriver: Waiting for application to start
 [info ] FlutterDriver: Waiting for application to start
 [info ] FlutterDriver: Waiting for application to start

Here's are the first few lines of the test.

void main() {
group('scrolling performance test', () {
FlutterDriver driver;

setUpAll(() async {
  // Connects to the app
  driver = await FlutterDriver.connect(dartVmServiceUrl: 'http://127.0.0.1:54270');
});

tearDownAll(() async {
  if (driver != null) {
    // Closes the connection
    driver.close();
  }
});

test('measure', () async {

Flutter Doctor output:

flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, v0.5.8-pre.56, on Mac OS X 10.13.4 17E202, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.4.1)
[✓] Android Studio (version 3.0)
 ✗ Flutter plugin not installed; this adds Flutter specific functionality.
 ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] IntelliJ IDEA Community Edition (version 2017.1.6)
[!] VS Code (version 1.24.1)
[✓] Connected devices (1 available)

! Doctor found issues in 1 category.

Thank you for any ideas you can give me.

Could you check if an Xcode build config is set that may be overriding the target file flutter drive was running? I found a similar issue and setting flavors worked on the integration test for them.

use flutter run and look at the url that returns in the console where the app is running, that is the one you should use in your dartVmServiceUrl parameter

source: https://medium.com/flutter-community/blazingly-fast-flutter-driver-tests-5e375c833aa

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM