Skip to content

Evaluate code in Debug Console during integration tests #4206

@bartekpacia

Description

@bartekpacia

Describe the bug

TL;DR I can't evaluate code in Debug Console when running integration tests. I don't know if I'm doing something wrong or if this is just not possible.

Also, I can't find a way to run (using VS Code's launch.json) normal widget tests with flutter run test/widget_test.dart (=running on device) instead of flutter test test/widget_test.dart (running in isolation). This might be another issue, though.

To Reproduce

TL;DR Run any Flutter integration test with VS Code and try to evaluate Dart code in the Debug Console.

Create .vscode/launch.json in the root of a Flutter project with the following contents:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "flutter run app",
      "request": "launch",
      "type": "dart",
      "program": "lib/main.dart"
    },
    {
      "name": "flutter run integration tests",
      "request": "launch",
      "type": "dart",
      "program": "integration_test/example_test.dart"
    },
  ]
}
  1. Clone the repository of the Patrol framework
  2. Open the example app directory with VS Code ($ code .). It's located in packages/patrol/example
  3. Now that you're in the example app's dir, put a breakpoint somewhere in the integration_test/example_test.dart file, for example on line 16:
    await $(FloatingActionButton).tap();
  4. Run the flutter run integration tests configuration from launch.json
  5. Try to evaluate some code in the Debug Console.
  6. See _compileExpression: No compilation service available; cannot evaluate from source..

Screenshot 2022-10-07 at 12 55 27 AM

Expected behavior

Being able to evaluate Dart code in Debug Console when the test is stopped on a breakpoint.

This is how it works with widget tests running in isolation:

Running.widget.test.in.isolation.mov

System info

  • Operating System and version: macOS 12.6 on MacBook Air M1
  • VS Code version: 1.72.0
  • Dart extension version: v3.50.0
  • Dart/Flutter SDK version: Dart 2.18.2, Flutter 3.3.3
  • Target device: Android emulator (Pixel 5 API 33)

Metadata

Metadata

Assignees

No one assigned

    Labels

    in flutterRelates to running Flutter appsin testingRelates to test execution of Dart/Flutter tests for end usersis enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions