【发布时间】:2018-12-31 09:11:56
【问题描述】:
我正在尝试使用基于此处示例的颤振驱动程序编写一些集成测试:https://flutter.io/testing/。我能够部署应用程序,但我得到的只是等待应用程序响应。 我真的不知道还能做什么,因为它只是坐着等待。 这是我在终端中看到的。
flutter drive --target=test_driver/home_category_list_scroll.dart
Using device Sampson's iPhone.
Starting application: test_driver/home_category_list_scroll.dart
Automatically signing iOS for device deployment using specified
development team in Xcode project: QDCF25JLN2
Running pod install... 7.2s
Starting Xcode build...
├─Assembling Flutter resources... 13.0s
└─Compiling, linking and signing... 7.5s
Xcode build done. 27.6s
Installing and launching...
flutter: Observatory listening on http://127.0.0.1:54774/
00:00 +0: scrolling performance test (setUpAll)
[info ] FlutterDriver: Connecting to Flutter application at
http://127.0.0.1:54270
[info ] FlutterDriver: Waiting for application to start
[info ] FlutterDriver: Waiting for application to start
[info ] FlutterDriver: Waiting for application to start
这是测试的前几行。
void main() {
group('scrolling performance test', () {
FlutterDriver driver;
setUpAll(() async {
// Connects to the app
driver = await FlutterDriver.connect(dartVmServiceUrl: 'http://127.0.0.1:54270');
});
tearDownAll(() async {
if (driver != null) {
// Closes the connection
driver.close();
}
});
test('measure', () async {
Flutter Doctor 输出:
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, v0.5.8-pre.56, on Mac OS X 10.13.4 17E202, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.4.1)
[✓] Android Studio (version 3.0)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] IntelliJ IDEA Community Edition (version 2017.1.6)
[!] VS Code (version 1.24.1)
[✓] Connected devices (1 available)
! Doctor found issues in 1 category.
谢谢你能给我的任何想法。
【问题讨论】:
-
flutter: Observatory listening on http://127.0.0.1:54774/但您已将 vm 服务 url 硬编码为http://127.0.0.1:54270。 -
感谢您的回复。我一直在为此苦苦挣扎。当我省略硬编码的网址时。获取 url Platform.environment['VM_SERVICE_URL'] 的调用始终返回 null。我一直无法弄清楚 VM_SERVICE_URL 应该是什么。关于 dartVmServiceUrl 应该是什么的任何想法。感谢您提供的任何帮助!
-
如果你不考虑它会起作用吗?
-
不,它不起作用。我收到消息:
Could not determine URL to connect to application. Either the VM_SERVICE_URL environment variable should be set, or an explicit URL should be provided to the FlutterDriver.connect() method. -
driver = await FlutterDriver.connect();应该会找到默认的天文台。如果没有,我将作为健全性测试创建一个新的默认项目(计数器应用程序)并确认提供的集成测试运行。然后从那里去。
标签: flutter flutter-test