Repository navigation
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: desktopRunning on desktopRunning on desktopa: tests"flutter test", flutter_test, or one of our tests"flutter test", flutter_test, or one of our testsplatform-linuxBuilding on or for Linux specificallyBuilding on or for Linux specificallyplatform-macosBuilding on or for macOS specificallyBuilding on or for macOS specificallyteam-toolOwned by Flutter Tool teamOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.tool-still-validIssues that have been deemed still valid as part of the Flutter Tools issue cleanup initiative.Issues that have been deemed still valid as part of the Flutter Tools issue cleanup initiative.triaged-toolTriaged by Flutter Tool teamTriaged by Flutter Tool team
Description
(This may well apply to the other desktop platform as well; I haven't tried them, but a lot of the flutter code to run desktop apps is similar across platforms.)
STR:
- Check out flutter/packages and cd to
packages/video_player/video_player/example - Run
flutter test -d macos integration_test/controller_swap_test.dart - Run
flutter test -d macos integration_test/video_player_test.dart - Run
flutter test -d macos integration_test/
Steps 2 and 3 work fine. Step 4 however, which should have essentially the same effect as 2+3 (those are the two test files in that directory), runs one set of tests—the app visibly launches, then quits—then when it tries to run the second launches the app but doesn't run tests, and instead logs:
TestDeviceException(Unable to start the app on the device.)
package:flutter_tools/src/test/integration_test_device.dart 63:7 IntegrationTestTestDevice.start
Bad state: Cannot add new events after calling close
dart:async/broadcast_stream_controller.dart 243:24 _BroadcastStreamController.add
dart:async/zone.dart 1407:47 _rootRunUnary
dart:async/zone.dart 1308:19 _CustomZone.runUnary
dart:async/zone.dart 1217:7 _CustomZone.runUnaryGuarded
dart:async/stream_impl.dart 339:11 _BufferingStreamSubscription._sendData
dart:async/stream_impl.dart 271:7 _BufferingStreamSubscription._add
dart:async/stream_controller.dart 784:19 _SyncStreamControllerDispatch._sendData
dart:async/stream_controller.dart 658:7 _StreamController._add
dart:async/stream_controller.dart 606:5 _StreamController.add
dart:io-patch/socket_patch.dart 2447:41 _Socket._onData
dart:async/zone.dart 1415:13 _rootRunUnary
dart:async/zone.dart 1308:19 _CustomZone.runUnary
dart:async/zone.dart 1217:7 _CustomZone.runUnaryGuarded
dart:async/stream_impl.dart 339:11 _BufferingStreamSubscription._sendData
dart:async/stream_impl.dart 271:7 _BufferingStreamSubscription._add
dart:async/stream_controller.dart 784:19 _SyncStreamControllerDispatch._sendData
dart:async/stream_controller.dart 658:7 _StreamController._add
dart:async/stream_controller.dart 606:5 _StreamController.add
dart:io-patch/socket_patch.dart 1936:33 new _RawSocket.<fn>
dart:io-patch/socket_patch.dart 1379:14 _NativeSocket.issueReadEvent.issue
dart:async/schedule_microtask.dart 40:21 _microtaskLoop
dart:async/schedule_microtask.dart 49:5 _startMicrotaskLoop
dart:isolate-patch/isolate_patch.dart 118:13 _runPendingImmediateCallback
dart:isolate-patch/isolate_patch.dart 185:5 _RawReceivePort._handleMessage
and then sits there doing nothing with the app still open.
It looks like something about the flutter test logic for desktop is trying to re-use a stream when it does subsequent launches.
Reacted by Zemlianikin Maksim, f69, Luciano Rodrigues, Paul, Jean-Philippe Lévesque, Ankit Mahato, jigar-f, Evan Rolfe, Bien Nguyen, Miguel Ferreira and 3 more
Reacted by Zemlianikin Maksim, jigar-f and Aliaksandr Kazarez
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: desktopRunning on desktopRunning on desktopa: tests"flutter test", flutter_test, or one of our tests"flutter test", flutter_test, or one of our testsplatform-linuxBuilding on or for Linux specificallyBuilding on or for Linux specificallyplatform-macosBuilding on or for macOS specificallyBuilding on or for macOS specificallyteam-toolOwned by Flutter Tool teamOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.tool-still-validIssues that have been deemed still valid as part of the Flutter Tools issue cleanup initiative.Issues that have been deemed still valid as part of the Flutter Tools issue cleanup initiative.triaged-toolTriaged by Flutter Tool teamTriaged by Flutter Tool team
Activity
[-]`flutter test` can't run multiple integration tests on macOS[/-][+]`flutter test` can't run multiple integration test files on macOS[/+]flutter-triage-bot commentedon Oct 2, 2023
The
fyi-toollabel is redundant with theteam-toollabel.11 remaining items
jigar-f commentedon Oct 28, 2024
biendltb commentedon Apr 14, 2025
I could confirm that it still happens in Linux. One workaround is to change the main() in all the integration test file in to separate functions and create a runner file which runs all of those fuctions. I don't like this idea either since the we sometimes need separation between tests.
welcomeworld commentedon Mar 28, 2026
[tool] Extend `flutter test` workaround to other desktops (flutter#6024)
[tool] Extend `flutter test` workaround to other desktops (flutter#6024)
fix(desktop): Keep an open log stream on desktop for integration test…
fix(desktop): Keep an open log stream on desktop for integration test…
fix(desktop): Keep an open log stream on desktop for integration test…
fix(desktop): Keep an open log stream on desktop for integration test…
fix(desktop): Keep an open log stream on desktop for integration test…
bkonyi commentedon Aug 27, 2026
Fixed in #189192 (commit 3a1a745).
github-actions commentedon Sep 10, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.