-
Notifications
You must be signed in to change notification settings - Fork 308
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
Evaluate code in Debug Console during integration tests #4206
Comments
This is unfortunately a known limitation. It requires work in Flutter to hook up an compilation service for expression evaluation. There's an issue tracking that at flutter/flutter#79439.
You can do this by adding You can also set this up to add additional CodeLens links with something like this: {
"name": "Test on Device",
"request": "launch",
"type": "dart",
"runTestsOnDevice": true,
"codeLens": {
"for": [
"run-test-file",
"debug-test-file"
],
"path": "test",
"title": "${debugType} on Device"
}
}, This will add additional "Run on Device" and "Debug on Device" links above the This is only possible for the whole file (not individual tests), because Hope this helps! |
Thanks for answering my second little question. Works, indeed :) But it's sad that we can't evaluate Dart code in Debug Console when running integration tests. I hope this gets implemented soon. Thanks for your help. |
Yeah, I understand. Unfortunately I don't understand how the compilation service works well enough to know whether it's a big change or not. I would encourage adding 👍 's to that Flutter issue if you haven't already. I'll close this issue as there's actually nothing to do in the VS Code extension. Once implemented in Flutter, it will just start working here. |
@DanTup Now I got this idea: is it possible to run a test file in the integration test directory with I'm thinking about something like: {
"version": "0.2.0",
"configurations": [
{
"name": "run app",
"request": "launch",
"type": "dart",
"program": "lib/main.dart"
},
{
"name": "run integration test",
"request": "launch",
"type": "dart",
"runTestsOnDevice": true,
"executeWithFlutterRun": true, // <-- let's assume that this flag exists
"program": "integration_test/example_test.dart"
}
]
}
I haven't found a way to do the above. In other words: when I run the This would have the following benefits:
Of course, this approach isn't ideal – we'll lose the test reporting ability (and probably more But as a temporary workaround, I think it's an approach worth researching. |
@bartekpacia that's essentially what Let me ping on that issue and see if anyone can give an idea of the scale of work and pointers to see if it might be something I could contribute there. |
Re-opening this as a reminder because I think I have this working but need to come back to it. |
Thank you very much! 💙 Linking your PR: flutter/flutter#113481 |
I landed a fix for this in Flutter. It should be available on master now, and in some future stable Flutter SDK release. |
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 withflutter run test/widget_test.dart
(=running on device) instead offlutter 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:$ code .
). It's located inpackages/patrol/example
flutter run integration tests
configuration fromlaunch.json
_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:
Running.widget.test.in.isolation.mov
System info
The text was updated successfully, but these errors were encountered: