Skip to content

flutter test does not terminate flutter_tester processes when terminated #151230

Closed

Description

@DanTup

Steps to reproduce

  • create a test that takes a long time to run:
    import 'package:flutter_test/flutter_test.dart';
    
    void main() {
      testWidgets('Counter increments smoke test', (WidgetTester tester) async {
        await Future.delayed(const Duration(hours: 1));
      });
    }
  • Run the test with flutter test
  • After a few seconds of running, press Ctrl+C to terminate
  • Check the running process list for flutter_test processes

Expected results

Terminating the test run should also terminate flutter_tester.

Actual results

flutter_tester lives on in the background.

Code sample

Code sample
import 'package:flutter_test/flutter_test.dart';

void main() {
  testWidgets('Counter increments smoke test', (WidgetTester tester) async {
    await Future.delayed(const Duration(hours: 1));
  });
}

Screenshots or Video

Screenshots / Video demonstration

Screenshot 2024-07-03 115315

Logs

Logs
flutter test test/widget_test.dart -v
... ...
[   +3 ms] test 0: Started flutter_tester process at pid 16684
[ +159 ms] test 0: connected to test device, now awaiting test result
[        ] test 0: Waiting for test harness or tests to finish
00:06 +0: Counter increments smoke test                                                                                                              [+5629 ms] Running 2 shutdown hooks
[        ] Shutdown hooks complete
[        ] exiting with code 0
Terminate batch job (Y/N)? y

Flutter Doctor output

Doctor output
PS C:\Dev\Test Projects\dartcode_5165> flutter doctor -v
[!] Flutter (Channel master, 3.23.0-14.0.pre.108, on Microsoft Windows [Version 10.0.22631.3737], locale en-GB)
    • Flutter version 3.23.0-14.0.pre.108 on channel master at C:\Dev\Google\Flutter\Flutter main
    ! Warning: `dart` on your path resolves to C:\Dev\Tools\Dart\Stable\bin\dart.exe, which is not inside your current Flutter SDK checkout at
      C:\Dev\Google\Flutter\Flutter main. Consider adding C:\Dev\Google\Flutter\Flutter main\bin to the front of your path.
    • Upstream repository [email protected]:DanTup/flutter.git
    • FLUTTER_GIT_URL = [email protected]:DanTup/flutter.git
    • Framework revision 4cb6d38492 (15 hours ago), 2024-07-02 16:13:23 -0400
    • Engine revision 4427894144
    • Dart version 3.5.0 (build 3.5.0-321.0.dev)
    • DevTools version 2.37.0
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and
      upgrades.

[✓] Windows Version (Installed version of Windows is version 10 or higher)

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at C:\Users\danny\AppData\Local\Android\sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.9+0--11185874)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[✓] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.7.4)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.7.34031.279
    • Windows 10 SDK version 10.0.22621.0

[✓] Android Studio (version 2023.2)
    • Android Studio at C:\Program Files\Android\Android Studio
    • 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 17.0.9+0--11185874)

[✓] VS Code (version 1.90.2)
    • VS Code at C:\Users\danny\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.93.20240702

[✓] VS Code (version 1.91.0-insider)
    • VS Code at C:\Users\danny\AppData\Local\Programs\Microsoft VS Code Insiders
    • Flutter extension version 3.91.20240529

[✓] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22631.3737]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 126.0.6478.127
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 126.0.2592.61

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

Activity

  1. danagbemava-nc commented on Jul 3, 2024

    @danagbemava-nc
    Member

    Hi @DanTup, I think this might be a duplicate of #144222.

    Can you confirm if this is the case?

  2. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jul 3, 2024
  3. DanTup commented on Jul 3, 2024

    @DanTup
    ContributorAuthor

    Oops yes, I think you're right. Although the earlier comments mention this only being in VS Code, apparently I commented confirming it could be reproduced without VS Code (#144222 (comment)).

    I'll close this one and update the title of that one to make it a little clearer. Thanks!

  4. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jul 3, 2024
  5. added
    r: duplicateIssue is closed as a duplicate of an existing issue
    and removed
    in triagePresently being triaged by the triage team
    on Jul 3, 2024
  6. github-actions commented on Jul 17, 2024

    @github-actions

    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 -v and a minimal reproduction of the issue.

  7. locked as resolved and limited conversation to collaborators on Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    r: duplicateIssue is closed as a duplicate of an existing issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions