Min*_*sky 23 tdd unit-testing dart flutter
我尝试在 Dart 中为 Flutter 应用程序的业务逻辑进行测试驱动开发(TDD)。对于快速 TDD 周期,运行测试的启动时间感觉有点慢。在我的机器上大约是 4-5 秒。
我正在使用package:test/test.dart,因此无需将应用程序部署到设备上,并且测试可以在 Dart VM 上本地运行。测试本身运行得很快。
使用 Java 的 JUnit 和本地 Java VM 开发 Android 本机应用程序时,启动时间要快得多 < 1 秒。
有没有办法让 Dart 中的单元测试的启动时间也那么快?(无需购买速度更快的物理机)。
编辑: 我的 Dart 版本:
Dart 测试在 Flutter 项目中。我通过右键单击带有测试的文件或仅使用 IDE 中的“>”运行测试按钮,在 Android Studio 中启动 Dart 测试。然后 Android Studio 会生成一个运行配置,因此我可以使用键盘快捷键快速启动它。
我最近尝试运行一个示例测试(使用 Flutter 演示应用程序),flutter test通过终端运行可以立即初始化测试。
然而,当通过 UI 运行测试时,我得到了类似的启动时间(大约 4 秒)。
\n\n我尝试深入研究设置,但似乎没有任何配置可供我们修改以使测试初始化速度比我们目前的速度更快。
\n这是我的扑扑医生供参考。
\n[\xe2\x9c\x93] Flutter (Channel master, 1.26.0-2.0.pre.281, on macOS 11.1 20C69 darwin-x64)\n \xe2\x80\xa2 Flutter version 1.26.0-2.0.pre.281\n \xe2\x80\xa2 Framework revision 4d5db88998 (2 weeks ago), 2021-01-11 10:29:26 -0800\n \xe2\x80\xa2 Engine revision d5cacaa3a6\n \xe2\x80\xa2 Dart version 2.12.0 (build 2.12.0-211.0.dev)\n\n[\xe2\x9c\x93] Android toolchain - develop for Android devices (Android SDK version 29.0.2)\n \xe2\x80\xa2 Platform android-30, build-tools 29.0.2\n \xe2\x80\xa2 Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java\n \xe2\x80\xa2 Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)\n \xe2\x80\xa2 All Android licenses accepted.\n\n[\xe2\x9c\x93] Xcode - develop for iOS and macOS (Xcode 12.0.1)\n \xe2\x80\xa2 Xcode at /Applications/Xcode.app/Contents/Developer\n \xe2\x80\xa2 Xcode 12.0.1, Build version 12A7300\n \xe2\x80\xa2 CocoaPods version 1.10.0\n\n[\xe2\x9c\x93] Chrome - develop for the web\n \xe2\x80\xa2 Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome\n\n[\xe2\x9c\x93] Android Studio (version 4.1)\n \xe2\x80\xa2 Android Studio at /Applications/Android Studio.app/Contents\n \xe2\x80\xa2 Flutter plugin can be installed from:\n https://plugins.jetbrains.com/plugin/9212-flutter\n \xe2\x80\xa2 Dart plugin can be installed from:\n https://plugins.jetbrains.com/plugin/6351-dart\n \xe2\x80\xa2 Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)\n\n[\xe2\x9c\x93] VS Code (version 1.52.1)\n \xe2\x80\xa2 VS Code at /Applications/Visual Studio Code.app/Contents\n \xe2\x80\xa2 Flutter extension version 3.18.1\n\n[\xe2\x9c\x93] Connected device (1 available)\n \xe2\x80\xa2 Chrome (web) \xe2\x80\xa2 chrome \xe2\x80\xa2 web-javascript \xe2\x80\xa2 Google Chrome 88.0.4324.96\n\n\xe2\x80\xa2 No issues found!\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
2700 次 |
| 最近记录: |