从 Visual Studio Code 运行所有 Flutter 单元测试

use*_*706 5 dart visual-studio-code flutter

  1. 在 Visual Studio Code 中,我没有看到用于运行所有 Flutter 单元测试的 GUI 选项。我必须单独选择每个测试文件,右键单击,然后选择“开始调试”或“开始但不调试”。
  2. 当模拟器运行时,我无法执行上述操作。我无法从 GUI 运行任何单元测试

我的单元测试位于 test 目录中,并且全部以“_test.dart”结尾。为了解决上述两个问题,我可以通过flutter test从终端运行所有单元测试,但我想知道是否有 GUI 选项。

Android Studio 上不存在此问题。

ngl*_*ber 6

你试过这个吗? https://dartcode.org/releases/v2-21/

将以下内容添加到您的launch.json文件中。如果您没有 launch.json 文件,请转到 VS Code 中的“运行”视图,然后单击create a launch.json file

{
    "name": "All Tests",
    "type": "dart",
    "request": "launch",
    "program": "tests/", // or test/foo for a subset of tests
}
Run Code Online (Sandbox Code Playgroud)