Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flutter Integration testing fail when moving between tests #101031

Open
HugoCSWork opened this issue Mar 30, 2022 · 14 comments
Open

Flutter Integration testing fail when moving between tests #101031

HugoCSWork opened this issue Mar 30, 2022 · 14 comments
Labels
a: tests "flutter test", flutter_test, or one of our tests c: crash Stack traces logged to the console f: integration_test The flutter/packages/integration_test plugin found in release: 2.10 Found to occur in 2.10 found in release: 2.13 Found to occur in 2.13 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 platform-linux Building on or for Linux specifically platform-mac Building on or for macOS specifically team-framework Owned by Framework team tool Affects the "flutter" command-line tool. See also t: labels. triaged-framework Triaged by Framework team

Comments

@HugoCSWork
Copy link

HugoCSWork commented Mar 30, 2022

There seems to be issues running multiple integration tests in separate files on desktop applications, where it crashes when moving between tests. It opens the second application to start testing but will be blank and the test will fail.

I have tested this on both macOS (M1) and Linux (ARM). The tests do work on an iOS emulator so it seems to definitely be a desktop specific issue.

Steps to Reproduce

  1. Have separate files for each test
  2. Execute flutter integration test
  3. First test will run fine
  4. Second app will open and the test will fails

Error Results

Screenshot 2022-03-30 at 10 13 17

Screenshot 2022-03-30 at 10 13 26

@danagbemava-nc danagbemava-nc added the in triage Presently being triaged by the triage team label Mar 30, 2022
@danagbemava-nc
Copy link
Member

Hi @HugoCSWork, thanks for filing the issue.

Can you please provide your flutter doctor -v and flutter test integration --verbose logs, and a minimal complete reproducible code sample?

Thank you

@danagbemava-nc danagbemava-nc added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Mar 30, 2022
@HugoCSWork
Copy link
Author

HugoCSWork commented Mar 30, 2022

Hi @danagbemava-nc thanks for getting back to me so quickly.

For the minimal complete product I have created a minimal project let me know if there's a better way to represent the issue. The link for that is here https://github.com/HugoCSWork/integration_config.

The information below will be using a Linux machine let me know if you also want the macOS one.

flutter doctor -v

image

flutter test integration --verbose

The image only contains information about the error I've copied the whole log of the second test underneath

image

Second test log (let me know if there's a better way to format this)
+190 ms] Observatory URL on device: http://127.0.0.1:36151/qz2iA0-jwQU=/
[   +2 ms] test 0: Connecting to vm service
[   +6 ms] test 0: Observatory uri is available at http://127.0.0.1:36151/qz2iA0-jwQU=/
[  +82 ms] test 0: Finding the correct isolate with the integration test service extension
[ +118 ms] test 0: connected to test device, now awaiting test result
[        ] test 0: Waiting for test harness or tests to finish
00:13 +1: /home/parallels/personal/integration_config/integration_test/app_test.dart: (tearDownAll)                                                                                                       [+1049 ms] test 0: Test harness is no longer needed by test process
[        ] test 0: finished
[        ] test 0: cleaning up...
[        ] test 0: ensuring test device is terminated.
[   +6 ms] test 0: Test process is no longer needed by test harness
[        ] test 0: deleting temporary directory
[        ] test 0: finished
00:13 +1: loading /home/parallels/personal/integration_config/integration_test/appd_test.dart                                                                                                             [        ] test 1: starting test /home/parallels/personal/integration_config/integration_test/appd_test.dart
[        ] Discovered flutter_test_config.dart in /home/parallels/personal/integration_config/integration_test
[        ] test 1: starting test device
[        ] test 1: awaiting connection to test device
[  +10 ms] Building Linux application...
[   +2 ms] executing: [build/linux/arm64/debug/] cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DFLUTTER_TARGET_PLATFORM=linux-arm64 /home/parallels/personal/integration_config/linux
[  +31 ms] -- Configuring done
[  +11 ms] -- Generating done
[        ] -- Build files have been written to: /home/parallels/personal/integration_config/build/linux/arm64/debug
[   +1 ms] executing: ninja -C build/linux/arm64/debug install
[   +8 ms] ninja: Entering directory `build/linux/arm64/debug'
00:24 +1: loading /home/parallels/personal/integration_config/integration_test/appd_test.dart                                                                                                             [+10967 ms] [1/7] Generating /home/parallels/personal/integration_config/linux/flutter/ephemeral/libflutter_linux_gtk.so,
/home/parallels/personal/integration_config/linux/flutter/ephemeral/flutter_linux/fl_basic_message_channel.h,
/home/parallels/personal/integration_config/linux/flutter/ephemeral/flutter_linux/fl_binary_codec.h,
/home/parallels/personal/integration_config/linux/flutter/ephemeral/flutter_linux/fl_binary_messenger.h,
/home/parallels/personal/integration_config/linux/flutter/ephemeral/flutter_linux/fl_dart_project.h, /home/parallels/personal/integration_config/linux/flutter/ephemeral/flutter_linux/fl_engine.h,
/home/parallels/personal/integration_config/linux/flutter/ephemeral/flutter_linux/fl_json_message_codec.h,
/home/parallels/personal/integration_config/linux/flutter/ephemeral/flutter_linux/fl_json_method_codec.h,
/home/parallels/personal/integration_config/linux/flutter/ephemeral/flutter_linux/fl_message_codec.h, /home/parallels/personal/integration_config/linux/flutter/ephemeral/flutter_linux/fl_method_call.h,
/home/parallels/personal/integration_config/linux/flutter/ephemeral/flutter_linux/fl_method_channel.h, /home/parallels/personal/integration_config/linux/flutter/ephemeral/flutter_linux/fl_method_codec.h,
/home/parallels/personal/integration_config/linux/flutter/ephemeral/flutter_linux/fl_method_response.h,
/home/parallels/personal/integration_config/linux/flutter/ephemeral/flutter_linux/fl_plugin_registrar.h,
/home/parallels/personal/integration_config/linux/flutter/ephemeral/flutter_linux/fl_plugin_registry.h,
/home/parallels/personal/integration_config/linux/flutter/ephemeral/flutter_linux/fl_standard_message_codec.h,
/home/parallels/personal/integration_config/linux/flutter/ephemeral/flutter_linux/fl_standard_method_codec.h,
/home/parallels/personal/integration_config/linux/flutter/ephemeral/flutter_linux/fl_string_codec.h, /home/parallels/personal/integration_config/linux/flutter/ephemeral/flutter_linux/fl_value.h,
/home/parallels/personal/integration_config/linux/flutter/ephemeral/flutter_linux/fl_view.h, /home/parallels/personal/integration_config/linux/flutter/ephemeral/flutter_linux/flutter_linux.h, _phony_
[  +14 ms] [  +26 ms] executing: uname -m
[        ] [  +17 ms] Exit code 0 from: uname -m
[        ] [        ] aarch64
[        ] [   +2 ms] executing: [/home/parallels/snap/flutter/common/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] [   +3 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] [        ] 89cc02006fcb6f5dee3e0076214f501cdea9de7f
[        ] [        ] executing: [/home/parallels/snap/flutter/common/flutter/] git tag --points-at 89cc02006fcb6f5dee3e0076214f501cdea9de7f
[        ] [  +11 ms] Exit code 0 from: git tag --points-at 89cc02006fcb6f5dee3e0076214f501cdea9de7f
[        ] [   +1 ms] executing: [/home/parallels/snap/flutter/common/flutter/] git describe --match *.*.* --long --tags 89cc02006fcb6f5dee3e0076214f501cdea9de7f
[   +3 ms] [  +31 ms] Exit code 0 from: git describe --match *.*.* --long --tags 89cc02006fcb6f5dee3e0076214f501cdea9de7f
[        ] [        ] 2.12.0-4.0.pre-312-g89cc02006f
[        ] [   +4 ms] executing: [/home/parallels/snap/flutter/common/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[        ] [   +3 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] [        ] origin/master
[        ] [        ] executing: [/home/parallels/snap/flutter/common/flutter/] git ls-remote --get-url origin
[        ] [   +2 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] [        ] https://github.com/flutter/flutter.git
[        ] [  +25 ms] Unable to locate an Android SDK.
[        ] [   +1 ms] executing: [/home/parallels/snap/flutter/common/flutter/] git rev-parse --abbrev-ref HEAD
[        ] [   +2 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] [        ] master
[        ] [  +22 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] [        ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[   +5 ms] [        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[        ] [  +41 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[        ] [        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[   +1 ms] [        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[        ] [        ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'PubDependencies' is not required, skipping update.
[        ] [  +17 ms] Initializing file store
[        ] [   +7 ms] Skipping target: gen_localizations
[        ] [   +5 ms] gen_dart_plugin_registrant: Starting due to {InvalidatedReasonKind.inputChanged: The following inputs have updated contents:
/home/parallels/personal/integration_config/.dart_tool/package_config_subset}
[   +6 ms] [   +1 ms] unpack_linux: Starting due to {}
[        ] [  +46 ms] unpack_linux: Complete
[        ] [ +397 ms] Found plugin window_size at /home/parallels/.pub-cache/git/flutter-desktop-embedding-5c51870ced62a00e809ba4b81a846a052d241c9f/plugins/window_size/
[        ] [  +17 ms] Found plugin integration_test at /home/parallels/snap/flutter/common/flutter/packages/integration_test/
[        ] [   +2 ms] gen_dart_plugin_registrant: Complete
[        ] [        ] kernel_snapshot: Starting due to {}
[   +1 ms] [   +4 ms] /home/parallels/snap/flutter/common/flutter/bin/cache/dart-sdk/bin/dart --disable-dart-dev
/home/parallels/snap/flutter/common/flutter/bin/cache/dart-sdk/bin/snapshots/frontend_server.dart.snapshot --sdk-root
/home/parallels/snap/flutter/common/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk/ --target=flutter --no-print-incremental-dependencies -DFLUTTER_WEB_AUTO_DETECT=true
-DINTEGRATION_TEST_SHOULD_REPORT_RESULTS_TO_NATIVE=false -Ddart.vm.profile=false -Ddart.vm.product=false --enable-asserts --track-widget-creation --no-link-platform --packages
/home/parallels/personal/integration_config/.dart_tool/package_config.json --output-dill /home/parallels/personal/integration_config/.dart_tool/flutter_build/ac1f48ac5e4d8bbb042ae00741f52e4f/app.dill
--depfile /home/parallels/personal/integration_config/.dart_tool/flutter_build/ac1f48ac5e4d8bbb042ae00741f52e4f/kernel_snapshot.d
file:///tmp/flutter_tools.XKUUCI/flutter_test_listener.RFFCQX/listener.dart
[   +8 ms] [+7428 ms] kernel_snapshot: Complete
[        ] [ +363 ms] debug_bundle_linux-arm64_assets: Starting due to {}
[        ] [  +92 ms] debug_bundle_linux-arm64_assets: Complete
[        ] [ +500 ms] Persisting file store
[        ] [   +3 ms] Done persisting file store
[        ] [   +3 ms] build succeeded.
[        ] [   +3 ms] "flutter assemble" took 8,948ms.
[        ] [  +86 ms] ensureAnalyticsSent: 84ms
[        ] [        ] Running shutdown hooks
[        ] [        ] Shutdown hooks complete
[        ] [        ] exiting with code 0
[ +242 ms] [2/7] Building CXX object plugins/window_size/CMakeFiles/window_size_plugin.dir/window_size_plugin.cc.o
[  +40 ms] [3/7] Building CXX object CMakeFiles/integration_config.dir/flutter/generated_plugin_registrant.cc.o
[  +36 ms] [4/7] Building CXX object CMakeFiles/integration_config.dir/my_application.cc.o
[  +13 ms] [5/7] Linking CXX shared library plugins/window_size/libwindow_size_plugin.so
[  +68 ms] [6/7] Linking CXX executable intermediates_do_not_run/integration_config
[        ] [6/7] Install the project...
[   +6 ms] -- Install configuration: "Debug"
[   +5 ms] -- Installing: /home/parallels/personal/integration_config/build/linux/arm64/debug/bundle/integration_config
[        ] -- Set runtime path of "/home/parallels/personal/integration_config/build/linux/arm64/debug/bundle/integration_config" to "$ORIGIN/lib"
[        ] -- Installing: /home/parallels/personal/integration_config/build/linux/arm64/debug/bundle/data/icudtl.dat
[        ] -- Installing: /home/parallels/personal/integration_config/build/linux/arm64/debug/bundle/lib/libflutter_linux_gtk.so
[  +21 ms] -- Installing: /home/parallels/personal/integration_config/build/linux/arm64/debug/bundle/lib/libwindow_size_plugin.so
[        ] -- Installing: /home/parallels/personal/integration_config/build/linux/arm64/debug/bundle/data/flutter_assets
[        ] -- Installing: /home/parallels/personal/integration_config/build/linux/arm64/debug/bundle/data/flutter_assets/packages
[        ] -- Installing: /home/parallels/personal/integration_config/build/linux/arm64/debug/bundle/data/flutter_assets/packages/cupertino_icons
[        ] -- Installing: /home/parallels/personal/integration_config/build/linux/arm64/debug/bundle/data/flutter_assets/packages/cupertino_icons/assets
[        ] -- Installing: /home/parallels/personal/integration_config/build/linux/arm64/debug/bundle/data/flutter_assets/packages/cupertino_icons/assets/CupertinoIcons.ttf
[        ] -- Installing: /home/parallels/personal/integration_config/build/linux/arm64/debug/bundle/data/flutter_assets/FontManifest.json
[        ] -- Installing: /home/parallels/personal/integration_config/build/linux/arm64/debug/bundle/data/flutter_assets/fonts
[        ] -- Installing: /home/parallels/personal/integration_config/build/linux/arm64/debug/bundle/data/flutter_assets/fonts/MaterialIcons-Regular.otf
[        ] -- Installing: /home/parallels/personal/integration_config/build/linux/arm64/debug/bundle/data/flutter_assets/AssetManifest.json
[        ] -- Installing: /home/parallels/personal/integration_config/build/linux/arm64/debug/bundle/data/flutter_assets/version.json
[        ] -- Installing: /home/parallels/personal/integration_config/build/linux/arm64/debug/bundle/data/flutter_assets/NOTICES.Z
[        ] -- Installing: /home/parallels/personal/integration_config/build/linux/arm64/debug/bundle/data/flutter_assets/kernel_blob.bin
[  +27 ms] Building Linux application... (completed in 11.5s)
[   +6 ms] Error waiting for a debug connection: The log reader stopped unexpectedly, or never started.
00:24 +1 -1: loading /home/parallels/personal/integration_config/integration_test/appd_test.dart [E]                                                                                                      
  TestDeviceException(Unable to start the app on the device.)
  package:flutter_tools/src/test/integration_test_device.dart 61:7  IntegrationTestTestDevice.start
  
00:24 +1 -1: Some tests failed.                                                                                                                                                                           
[  +13 ms] test package returned with exit code 1
[   +1 ms] "flutter test" took 25,339ms.
[   +3 ms] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      TestCommand.runCommand (package:flutter_tools/src/commands/test.dart:472:7)
           <asynchronous suspension>
           #2      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1183:27)
           <asynchronous suspension>
           #3      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #4      CommandRunner.runCommand (package:args/command_runner.dart:209:13)
           <asynchronous suspension>
           #5      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
           <asynchronous suspension>
           #6      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #7      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
           <asynchronous suspension>
           #8      run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
           <asynchronous suspension>
           #9      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #10     main (package:flutter_tools/executable.dart:94:3)
           <asynchronous suspension>
           
           
[  +65 ms] ensureAnalyticsSent: 65ms
[        ] Running shutdown hooks
[        ] Shutdown hooks complete
[        ] exiting with code 1

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Mar 30, 2022
@danagbemava-nc
Copy link
Member

danagbemava-nc commented Mar 31, 2022

Issue is reproducible on stable and master using the code sample in https://github.com/HugoCSWork/integration_config.

I tested on macOS and iOS.

iOS works just fine whereas macOS fails when switching to the second test.

Steps to reproduce

  1. Clone the code sample in https://github.com/HugoCSWork/integration_config
  2. Run the tests in the integration_test folder with flutter test integration_test with a desktop target

Labeling for further investigation

logs

ios_log.txt
macos.txt

flutter doctor -v
[✓] Flutter (Channel stable, 2.10.4, on macOS 12.2.1 21D62 darwin-arm, locale en-GB)
    • Flutter version 2.10.4 at /Users/nexus/dev/sdks/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision c860cba910 (6 days ago), 2022-03-25 00:23:12 -0500
    • Engine revision 57d3bac3dd
    • Dart version 2.16.2
    • DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/nexus/Library/Android/sdk
    • Platform android-32, build-tools 31.0.0
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)

[☠] IntelliJ IDEA Community Edition (the doctor check crashed)
    ✗ Due to an error, the doctor check did not complete. If the error message below is
      not helpful, please let us know about this issue at
      https://github.com/flutter/flutter/issues.
    ✗ FormatException: Unexpected extension byte (at offset 5)
    • #0      _Utf8Decoder.convertSingle (dart:convert-patch/convert_patch.dart:1789:7)
      #1      Utf8Decoder.convert (dart:convert/utf.dart:351:42)
      #2      InputStream.readString (package:archive/src/util/input_stream.dart:207:30)
      #3      new ZipDirectory.read (package:archive/src/zip/zip_directory.dart:40:30)
      #4      ZipDecoder.decodeBuffer (package:archive/src/zip_decoder.dart:19:30)
      #5      ZipDecoder.decodeBytes (package:archive/src/zip_decoder.dart:14:12)
      #6      IntelliJPlugins._findPluginXml
      (package:flutter_tools/src/intellij/intellij.dart:130:44)
      #7      IntelliJPlugins._readPackageVersion
      (package:flutter_tools/src/intellij/intellij.dart:141:40)
      #8      IntelliJPlugins.validatePackage
      (package:flutter_tools/src/intellij/intellij.dart:63:35)
      #9      IntelliJValidator.validate
      (package:flutter_tools/src/intellij/intellij_validator.dart:103:15)
      #10     asyncGuard.<anonymous closure>
      (package:flutter_tools/src/base/async_guard.dart:111:32)
      #11     asyncGuard.<anonymous closure>
      (package:flutter_tools/src/base/async_guard.dart:109:18)
      #12     _rootRun (dart:async/zone.dart:1426:13)
      #13     _CustomZone.run (dart:async/zone.dart:1328:19)
      #14     _runZoned (dart:async/zone.dart:1861:10)
      #15     runZonedGuarded (dart:async/zone.dart:1849:12)
      #16     runZoned (dart:async/zone.dart:1780:12)
      #17     asyncGuard (package:flutter_tools/src/base/async_guard.dart:109:3)
      #18     Doctor.startValidatorTasks (package:flutter_tools/src/doctor.dart:205:9)
      #19     Doctor.diagnose (package:flutter_tools/src/doctor.dart:309:47)
      #20     DoctorCommand.runCommand
      (package:flutter_tools/src/commands/doctor.dart:50:48)
      #21     FlutterCommand.verifyThenRunCommand
      (package:flutter_tools/src/runner/flutter_command.dart:1320:12)
      <asynchronous suspension>
      #22     FlutterCommand.run.<anonymous closure>
      (package:flutter_tools/src/runner/flutter_command.dart:1161:27)
      <asynchronous suspension>
      #23     AppContext.run.<anonymous closure>
      (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #24     CommandRunner.runCommand (package:args/command_runner.dart:209:13)
      <asynchronous suspension>
      #25     FlutterCommandRunner.runCommand.<anonymous closure>
      (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
      <asynchronous suspension>
      #26     AppContext.run.<anonymous closure>
      (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #27     FlutterCommandRunner.runCommand
      (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
      <asynchronous suspension>
      #28     run.<anonymous closure>.<anonymous closure>
      (package:flutter_tools/runner.dart:62:9)
      <asynchronous suspension>
      #29     AppContext.run.<anonymous closure>
      (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #30     main (package:flutter_tools/executable.dart:94:3)
      <asynchronous suspension>


[✓] VS Code (version 1.66.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.36.0

[✓] Connected device (3 available)
    • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64  • Android 12 (API 31)
      (emulator)
    • macOS (desktop)             • macos         • darwin-arm64   • macOS 12.2.1 21D62
      darwin-arm
    • Chrome (web)                • chrome        • web-javascript • Google Chrome
      100.0.4896.60

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.
[✓] Flutter (Channel master, 2.13.0-0.0.pre.330, on macOS 12.2.1 21D62 darwin-arm,
    locale en-GB)
    • Flutter version 2.13.0-0.0.pre.330 at /Users/nexus/dev/sdks/flutters
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 9e77d3ef48 (2 hours ago), 2022-03-31 00:40:09 -0400
    • Engine revision 14d728777e
    • Dart version 2.17.0 (build 2.17.0-251.0.dev)
    • DevTools version 2.11.4

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/nexus/Library/Android/sdk
    • Platform android-32, build-tools 31.0.0
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)

[✓] IntelliJ IDEA Community Edition (version 2021.3)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin version 213.5744.122

[✓] VS Code (version 1.66.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.36.0

[✓] Connected device (3 available)
    • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64  • Android 12 (API 31)
      (emulator)
    • macOS (desktop)             • macos         • darwin-arm64   • macOS 12.2.1 21D62
      darwin-arm
    • Chrome (web)                • chrome        • web-javascript • Google Chrome
      100.0.4896.60

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

Hi @HugoCSWork, kindly note that for logs, we prefer text to screenshots because screenshots are not searchable. If the logs are too large for github, put it into a .txt/.log file and attach it.

@danagbemava-nc danagbemava-nc added a: tests "flutter test", flutter_test, or one of our tests c: crash Stack traces logged to the console framework flutter/packages/flutter repository. See also f: labels. a: desktop Running on desktop f: integration_test The flutter/packages/integration_test plugin has reproducible steps The issue has been confirmed reproducible and is ready to work on found in release: 2.10 Found to occur in 2.10 found in release: 2.13 Found to occur in 2.13 and removed in triage Presently being triaged by the triage team labels Mar 31, 2022
@danagbemava-nc danagbemava-nc changed the title Flutter Integration testing failing when moving between tests [desktop]Flutter Integration testing fail when moving between tests Mar 31, 2022
@gspencergoog gspencergoog added platform-linux Building on or for Linux specifically platform-mac Building on or for macOS specifically tool Affects the "flutter" command-line tool. See also t: labels. P2 Important issues not at the top of the work list and removed a: desktop Running on desktop labels Mar 31, 2022
@gspencergoog
Copy link
Contributor

cc @cbracken

@darshankawar darshankawar changed the title [desktop]Flutter Integration testing fail when moving between tests Flutter Integration testing fail when moving between tests Apr 21, 2022
@cbracken
Copy link
Member

@davidfrankl
Copy link

Is there a workaround to this issue? My team has resorted to putting all our integration tests into one file, which works, but is undesirable for a complicated application.

@Sourabh0991
Copy link

Thanks @HugoCSWork for posting this. I am facing the same issue since long time.
Eagerly waiting for the final concrete solution on this.

@sangmai
Copy link

sangmai commented Jan 27, 2023

I've got a similar issue, please help me

@KoheiKanagu
Copy link

I had the same problem but solved it.

In my case, it was failing at xcrun simctl terminate when Integration Test terminates.
The cause was that the BundleID was incorrect.

My product dynamically changes the BundleID with dart-define.
Like Flavor.
The APP_SUFFIX in the example is passed as --dart-define APP_SUFFIX=.dev.

// ios/Runner.xcodeproj/project.pbxproj
PRODUCT_BUNDLE_IDENTIFIER = "com.example.app$(APP_SUFFIX)";

When the Integration Test terminates, I want it to terminate like this

xcrun simctl terminate 304CA91D-XXXX-XXXX-XXXX-ECFC57AFD011 com.example.app.dev

But in fact, APP_SUFFIX was missing and it was erroring out that it was a non-existent BundleID.

xcrun simctl terminate 304CA91D-XXXX-XXXX-XXXX-ECFC57AFD011 com.example.app

The solution was to create a Flavor for Integration Test with reference to Creating flavors for Flutter |Flutter and hardcode the BundleID as com.example.app.dev without using APP_SUFFIX.

As a result, the test now succeeds when Scheme is specified with --flavor.

flutter test --flavor integration_test

In my case, this occurred after upgrading to Flutter 3.7.0.
However, based on everyone's reports, I don't think Flutter 3.7.0 has anything to do with it.

@maskita
Copy link

maskita commented Feb 15, 2023

I experienced the same issue running multiple tests using the command : flutter test integration_test -d Windows. The first test works fine and the second one fails. I'm using Flutter 3.3.10.
Do you know if a fix is planned?

@janknips
Copy link

I'm not sure I have the same problem, but facing sporadic failures of the entire suite when running a command e.g. flutter test integration_test/test -d emulator-5554 --machine:

{"test":{"id":18,"name":"Post statistics: should show correct name when opening statistics details","suiteID":12,"groupIDs":[14,15],"metadata":{"skip":false,"skipReason":null},"line":154,"column":5,"url":"package:flutter_test/src/widget_tester.dart"},"type":"testStart","time":1002244}
{"testID":18,"result":"error","skipped":false,"hidden":false,"type":"testDone","time":1002247}
{"test":{"id":19,"name":"Post statistics: should show recently published hint when adding new post","suiteID":12,"groupIDs":[14,15],"metadata":{"skip":false,"skipReason":null},"line":154,"column":5,"url":"package:flutter_test/src/widget_tester.dart"},"type":"testStart","time":1002247}
{"testID":19,"result":"error","skipped":false,"hidden":false,"type":"testDone","time":1002247}
{"test":{"id":20,"name":"Post statistics: (tearDownAll)","suiteID":12,"groupIDs":[14,15],"metadata":{"skip":false,"skipReason":null},"line":null,"column":null,"url":null},"type":"testStart","time":1002247}
{"testID":20,"result":"error","skipped":false,"hidden":false,"type":"testDone","time":1002247}
{"group":{"id":21,"suiteID":12,"parentID":14,"name":"Flow post statistics:","metadata":{"skip":false,"skipReason":null},"testCount":2,"line":97,"column":3,"url":"file:///Users/builder/clone/Users/builder/clone/integration_test/test/posts/post_statistics_test.dart"},"type":"group","time":1002248}
{"test":{"id":22,"name":"Flow post statistics: (setUpAll)","suiteID":12,"groupIDs":[14,21],"metadata":{"skip":false,"skipReason":null},"line":98,"column":5,"url":"file:///Users/builder/clone/Users/builder/clone/integration_test/test/posts/post_statistics_test.dart"},"type":"testStart","time":1002248}

As you can see in the log, as soon as testStart event is printed, the test already errored, i.e. nothing happened.

@daniele-athome
Copy link

A possible workaround (but it breaks IntelliJ test reporting UI): run a single test file which calls all the main() methods from the other files.

import 'package:integration_test/integration_test.dart';

import 'bookflight_test.dart' as bookflight;
import 'flightlog_test.dart' as flightlog;
import 'onboarding_test.dart' as onboarding;

void main() {
  IntegrationTestWidgetsFlutterBinding.ensureInitialized();
  bookflight.main();
  flightlog.main();
  onboarding.main();
}

Maybe there is a way to load other test files dynamically but I haven't tried it yet - it would still be a workaround though :-)

appflowy pushed a commit to AppFlowy-IO/AppFlowy that referenced this issue Apr 4, 2023
* feat: add archive for compression

* feat: add service to manage zipped work spaces

* feat: export service in barrel file

* feat: ignore .ephemeral directory

* feat: add first compressed workspace file

* fix: directory path was wrong

* feat: add a somewhat useful test

* fix: move to same file (delete later)

* fix: use script path vs. working directory for CI

* fix: read from asset bundle instead of file system

* fix: workaround to run integration in multiple files on desktop (flutter/flutter#101031

* feat: remove .ephemeral from .gitignore, no longer created

* feat: document test changes

* fix: lucas suggestion

* feat: mark assets as excluded in pubspec.yaml

* feat: add class for build utilities

* feat: add script runner for release builds

* feat: add build script as task in flowy project

* fix: typo in pubspec.yaml

* chore: use constants for exclude tag

* feat: add appversion as argument to build tool

* feat: use dart script in release.yml

* chore: remove task

* fix: careless error

Co-authored-by: Mihir <84044317+squidrye@users.noreply.github.com>

* feat: add translations for view of

* fix: typo in getAllDatabase

* feat: add view of database

* fix: remove unused import

* fix: use effective dart typing

* fix: insertPage marked as async, should return future

* fix: Remove multi-line string

* fix: ref can be null

* fix: unused imports caused analyzer to fail

* feat: also fix. Add empty document as option and change name to _name

* chore: move referenced database tests to empty document test file

* feat: add test utilities

* feat: add new integration test on an empty document

* feat: register test in runner

* fix: missing reference in insert_page_command

* fix: analyzer errors

---------

Co-authored-by: Mihir <84044317+squidrye@users.noreply.github.com>
LucasXu0 pushed a commit to LucasXu0/AppFlowy that referenced this issue Apr 6, 2023
…lowy-IO#2083)

* feat: add archive for compression

* feat: add service to manage zipped work spaces

* feat: export service in barrel file

* feat: ignore .ephemeral directory

* feat: add first compressed workspace file

* fix: directory path was wrong

* feat: add a somewhat useful test

* fix: move to same file (delete later)

* fix: use script path vs. working directory for CI

* fix: read from asset bundle instead of file system

* fix: workaround to run integration in multiple files on desktop (flutter/flutter#101031

* feat: remove .ephemeral from .gitignore, no longer created

* feat: document test changes

* fix: lucas suggestion

* feat: mark assets as excluded in pubspec.yaml

* feat: add class for build utilities

* feat: add script runner for release builds

* feat: add build script as task in flowy project

* fix: typo in pubspec.yaml

* chore: use constants for exclude tag

* feat: add appversion as argument to build tool

* feat: use dart script in release.yml

* chore: remove task

* fix: careless error

Co-authored-by: Mihir <84044317+squidrye@users.noreply.github.com>

* feat: add translations for view of

* fix: typo in getAllDatabase

* feat: add view of database

* fix: remove unused import

* fix: use effective dart typing

* fix: insertPage marked as async, should return future

* fix: Remove multi-line string

* fix: ref can be null

* fix: unused imports caused analyzer to fail

* feat: also fix. Add empty document as option and change name to _name

* chore: move referenced database tests to empty document test file

* feat: add test utilities

* feat: add new integration test on an empty document

* feat: register test in runner

* fix: missing reference in insert_page_command

* fix: analyzer errors

---------

Co-authored-by: Mihir <84044317+squidrye@users.noreply.github.com>
@jtdLab
Copy link

jtdLab commented Jun 17, 2023

Any updates on this? I am still running into this error (on macOS) when using flutter test integration_test given:

integration_test/
  foo_test.dart
  bar_test.dart

@flutter-triage-bot flutter-triage-bot bot added multiteam-retriage-candidate team-framework Owned by Framework team triaged-framework Triaged by Framework team labels Jul 8, 2023
sku0x20 added a commit to sku0x20/flutter_spike_state_management that referenced this issue Oct 29, 2023
…ation tests.

anyways, that was a long way. this was in such a bad shape. learned things, again. still so much.
but with this, state idea i got. ui i need to see. ui is never ending. but now i have an idea how to approach and can always look back here for insights. quick look for further lookup. starting idea. and 'this exists'.
still this has multiple issues. like that delay of 8secs. idk, i have no idea how to solve that rn. fine for now tbh.
we will see.

i liked working with windows.
and how just easily it is to add support for android or windows to existing project. flutter create --platforms=android .

but in any case i liked this spike. learned quite good. was doing stuff badly last time. wow.
still so much to learn.

flutter/flutter#101031
flutter/samples#1000
jtdLab/rapid#114
@lapphong

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: tests "flutter test", flutter_test, or one of our tests c: crash Stack traces logged to the console f: integration_test The flutter/packages/integration_test plugin found in release: 2.10 Found to occur in 2.10 found in release: 2.13 Found to occur in 2.13 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 platform-linux Building on or for Linux specifically platform-mac Building on or for macOS specifically team-framework Owned by Framework team tool Affects the "flutter" command-line tool. See also t: labels. triaged-framework Triaged by Framework team
Projects
None yet
Development

No branches or pull requests