user2233706
user2233706

Reputation: 7207

Running all Flutter unit tests from Visual Studio Code

  1. In Visual Studio Code, I see no GUI option to run all my Flutter unit tests. I have to individually select each test file, right click, and choose either 'Start debugging' or 'Start without debugging.'
  2. When the emulator is running, I am unable unable to do the above. I cannot run any unit tests from the GUI

My unit tests are located in the test directory and all end in '_test.dart'. To get around both of the above, I can run all the unit tests by doing flutter test from the terminal, but I was wondering if there was a GUI option.

This issue does not exist on Android Studio.

Upvotes: 7

Views: 4827

Answers (1)

nglauber
nglauber

Reputation: 23894

Have you tried this? https://dartcode.org/releases/v2-21/

Add the following to your launch.json file. If you do not have a launch.json file, go to the Run view in VS Code and click create a launch.json file.

{
    "name": "All Tests",
    "type": "dart",
    "request": "launch",
    "program": "tests/", // or test/foo for a subset of tests
}

Upvotes: 8

Related Questions