gpt4 book ai didi

flutter - 如何在 chrome 平台上运行 flutter 测试? "No tests ran"尝试启动项目时

转载 作者:行者123 更新时间:2023-12-04 17:32:25 30 4
gpt4 key购买 nike

为了创建一个 android/web 应用程序,我想在特定平台上运行 flutter 测试。当我指定“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!

最佳答案

方法(一)

  • 打开终端
  • 转到项目目录的根目录
  • 输入这个 => 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

    关于flutter - 如何在 chrome 平台上运行 flutter 测试? "No tests ran"尝试启动项目时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58180937/

    30 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com