我正在为Flutter应用设置集成测试,无法将其连接到Firestore模拟器的实例。
这是我的代码:
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
Firestore firestore;
setUp(() async {
firestore = Firestore.instance;
await firestore.settings(host: 'http://localhost:4000/firestore');
});
group('some group', () {
test('some test', () async {
print('yo');
});
});
}
运行它时,出现以下错误:
ERROR: MissingPluginException(No implementation found for method Firestore#settings on channel plugins.flutter.io/cloud_firestore)
package:flutter/src/services/platform_channel.dart 154:7 MethodChannel._invokeMethod
关于如何解决此问题的任何建议?
答案 0 :(得分:2)
据我所知,Firebase不支持Flutter中的单元测试,因为它是需要本地集成的插件。
Flutter Firebase存储库中的测试在main.dart
中运行,而不是单元测试。