I have a suite of integration tests for a Flutter app. I would like to run them using the VS Code Testing tab, so that I can easily see info about what tests passed/failed, etc.
This worked fine before we implemented flavors. Now that flavors are defined in launch.json, running the tests require a --flavor argument, but I can't seem to set that in the UI.
If I try to run them on iOS using the Testing tab in VS Code, I get this error:
The Xcode project defines schemes: dev, prod, qa Exception: You must specify a --flavor option to select one of the available schemes.
I can run flutter test integration_test --flavor dev
, but the terminal fills up with logs and it's harder to find out which tests failed and why.
I just struggled with it too. You need to add this in your launch.json:
{
"name": "integration test",
"request": "launch",
"type": "dart",
// Define your flavor (here: foo) that you use in tests
"toolArgs": [
"--flavor",
"foo",
],
// This is important: set it only for integration_test
"templateFor": "integration_test",
},
Thats it! Now you can run them on VSCode too.