android-studio - Flutter 在 Android Studio 中运行多个单元测试
问题描述
我一直在关注这个 Flutter 文档: https ://flutter.dev/docs/cookbook/testing/unit/introduction
如果我打开文件并通过点击运行按钮运行它,我可以在 Android Studio 中运行测试。
问题是我想一键运行所有测试,就像在 Xcode 中一样。
如何在 Android Studio 中做到这一点?
我做了什么:
创建了两个愚蠢的测试,只是为了拥有它们。
使用选项创建测试配置All in Directory
并指向测试目录:
在点击播放按钮后,我得到:
Failed to load "/Users/martinberger/Dev/flutter_apps/iCash/icash/test/second_test.dart":
Test never connected to test harness.
Test: /Users/martinberger/Dev/flutter_apps/iCash/icash/test/second_test.dart
Shell: /Users/martinberger/Dev/flutter/bin/cache/artifacts/engine/darwin-x64/flutter_tester
所以第一个测试完成了,但是下一个,甚至没有开始。
在我读过的十几个教程/博客/文档中,他们都专注于编写一个测试并通过右键单击或打开它并单击“播放”按钮来运行它。
我来自 iOS/Xcode 背景,所以在 Android Studio 中运行一个简单的测试套件有什么我应该知道的吗?
解决方案
您可以flutter test
在终端中键入,然后键入您想要的目录。
所以在你的情况下:flutter test test/
推荐阅读
- linux - 如何在高山内进行 sudo?
- bash - 问:Bash 脚本从多个文件的变量中运行多个命令
- r - 四舍五入并保留足够的有效数字以将它们与邻居区分开来
- c++ - 节点预分配向量中的无锁树节点分配
- c# - C# Automapper -> 条件映射
- http - WebSphere Liberty 中 SOAP 客户端代理的基本认证
- php - 提交时的 PHP 联系表单验证
- java - org.springframework.scheduling.annotation @Async 抛出服务器错误
- rest - xpages:无法配置 inotes 日历控件以使用资源预留数据库
- javascript - Angular 6:脚本无法从 angular.json 正确加载