gpt4 book ai didi

flutter - 集成测试没有运行 flavor

转载 作者:行者123 更新时间:2023-12-05 04:49:10 29 4
gpt4 key购买 nike

我正在运行与 Flutter 应用程序的集成测试。我还在 Flutter 中使用 Flavors。问题是它给我这个错误:

Gradle build failed to produce an .apk file. It's likely that this file was generated under /home/khamidjon/Desktop/android_flutter_projects/my-project/build, but the tool couldn't find it.
  1. 我已将所有依赖项放入 pubspec.yaml 中。
  2. 如文档所述创建了 3 个目录:integration_test/、test_driver/、test/

test_driver/integration_test.dart:

import 'package:integration_test/integration_test_driver.dart';

Future<void> main() => integrationDriver();

integration_test/main_functions_test.dart:

import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';


void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();

testWidgets("failing test example", (WidgetTester tester) async {
expect(2 + 2, equals(5));
});
}

然后在终端中运行以下命令:

  flutter drive \
--driver=test_driver/integration_test.dart \
--target=integration_test/main_functions_test.dart

最佳答案

因为您正在使用 flavor ,所以您需要指定要运行您的应用程序的 flavor :

flutter drive \
--driver=test_driver/integration_test.dart \
--target=integration_test/main_functions_test.dart --flavor development

关于flutter - 集成测试没有运行 flavor ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67685777/

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