flutter - 使用 integration_test 包进行 Flutter 集成测试调试
问题描述
我正在使用 integration_test 包编写集成测试。它运作良好。
我在 CLI 中运行以下命令来开始测试。
flutter drive --driver=test_driver/integration_test_driver.dart --target=test/integration_tests/app_test.dart
但是每次我重新运行测试时都需要重建应用程序。能否避免 App 的重建?
也可以将调试器附加到测试用例,如调试单元或小部件测试。
解决方案
如果您使用的是 VS Code,则可以添加配置launch.json
来运行测试。将“程序”属性设置为集成测试的路径。
{
"name": "Integration Test: Run Test",
"program": "project_root/integration_test/foo_test.dart",
"request": "launch",
"type": "dart"
},
然后您可以在测试中添加断点来暂停执行。您也可以通过 VS Code 重新启动程序,测试将再次运行。如果你不使用 VS Code,在 ANdroid studio 中设置类似的配置应该很容易。
推荐阅读
- javascript - 从 addEventListner 或单独声明函数
- git - 为什么在使用未提交的更改切换分支时不会发生冲突?
- javascript - 如何在@sentry/nextjs 包中禁用源映射
- uri - 我在 uri 法官上收到演示文稿错误
- c++ - 我的计算器代码中有一个错误,我现在不知道如何修复它
- flutter - 等到函数返回 true
- mysql - SQL:子查询单行或多行
- android - 在模块中发现重复的类 com.mapbox.android.telemetry.AlarmReceiver。Mapbox安卓工作室
- python - 将 Numpy 数组转换为张量
- html - 防止来自 url 的跨站点脚本