为了创建一个android / web应用程序,我想在特定平台上运行抖动测试。当我指定“ chrome”时,将获得“没有运行测试”。当我执行“ flutter run -d chrome”时,应用程序当然可以工作
使用Flutter启动应用程序很容易重现该问题。这是我在linux上完成的操作:
mkdir chrome_test
cd chrome_test
create .
flutter test test/
=>所有测试均通过!
当我在test / widget_test.dart开始时添加@TestOn(“ vm”)时 =>所有测试都通过!
当我在test / widget_test.dart的开头添加@TestOn(“ chrome”)时 =>没有运行测试。
[✓] Flutter (Channel master, v1.10.6-pre.39, on Linux, locale fr_FR.UTF-8)
• Flutter version 1.10.6-pre.39 at /home/rbarbe/programes/flutter
• Framework revision 4815b26d71 (il y a 7 jours), 2019-09-24 00:21:44 -0700
• Engine revision 953ac71749
• Dart version 2.6.0 (build 2.6.0-dev.1.0 d53d355c6c)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /home/rbarbe/Android/Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: /home/rbarbe/programes/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✓] Android Studio (version 3.3)
• Android Studio at /home/rbarbe/programes/android-studio
• Flutter plugin version 39.0.3
• Dart plugin version 191.8423
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
[✓] IntelliJ IDEA Community Edition (version 2019.1)
• IntelliJ at /home/rbarbe/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/191.6183.87
• Flutter plugin version 35.2.2
• Dart plugin version 191.6183.88
[✓] IntelliJ IDEA Community Edition (version 2019.2)
• IntelliJ at /home/rbarbe/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/192.6603.28
• Flutter plugin version 39.0.5
• Dart plugin version 192.6603.23
[✓] VS Code (version 1.38.1)
• VS Code at /usr/share/code
• Flutter extension version 3.4.1
[✓] Connected device (2 available)
• Chrome • chrome • web-javascript • Google Chrome 77.0.3865.90
• Server • web • web-javascript • Flutter Tools
• No issues found!
答案 0 :(得分:0)
方法(一)
打开终端
进入项目的根目录
输入这个 => flutter run -d chrome --web-port 2021 test/home_test.dart
或者类似的东西
等待 chrome 跳出
在终端上查看结果!!
注意 => 将 test/home_test.dart 更改为您的文件名!
希望对你有用!
如果不尝试方法(2)。 也许你会找到答案!!
方法 (2) 仔细按照链接中给出的步骤操作。
https://flutter.dev/docs/cookbook/testing/integration/introduction