Evaluate code in Debug Console during integration tests
See original GitHub issueDescribe 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"
},
]
}
- Clone the repository of the Patrol framework
- Open the example app directory with VS Code (
$ code .
). It’s located inpackages/patrol/example
- 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();
- Run the
flutter run integration tests
configuration fromlaunch.json
- Try to evaluate some code in the Debug Console.
- See
_compileExpression: No compilation service available; cannot evaluate from source.
.
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:
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)
Issue Analytics
- State:
- Created a year ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Debugging in Visual Studio Code
Expressions are evaluated after you press Enter and the Debug Console REPL shows suggestions as you type. If you need to enter multiple...
Read more >Support expresssion evaluation when debugging Integration ...
Users today with flutter test are able to evaluate arbitrary expressions with an IDE while ... Evaluate code in Debug Console during integration...
Read more >Debug unit tests with Test Explorer - Visual Studio (Windows)
In Test Explorer, select the test method(s) and then choose Debug on the right-click menu. Test execution details. For more information, about ...
Read more >Running integration tests against the server in the same solution
The tests need to talk to a TCP server in the same solution and it'd like to debug both the test and the...
Read more >Evaluate expressions in runtime using Console
Define, declare, and verify new variables and functions while you debug a script in runtime using Console. The script execution must be paused ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Re-opening this as a reminder because I think I have this working but need to come back to it.
I landed a fix for this in Flutter. It should be available on master now, and in some future stable Flutter SDK release.