【发布时间】:2020-06-15 01:13:14
【问题描述】:
1。问题总结
我想要一个 Travis CI 设置,它可以让我在 Android 和 iOS 环境中运行 flutter driver 测试。为此,我希望我必须在不同的环境中安装 Flutter、Android 和 iOS。
2。我到目前为止所拥有的
我能找到的关于这个主题的大多数帖子都非常过时或具有极其复杂的设置。一些继续出现在我的搜索中的是:
-
Test Flutter apps on Travis,作者:叶戈尔·杰巴诺夫。这一个涵盖单元和小部件测试 (
flutter test),但不包括集成测试。-
它是从 2017 年初开始的,Travis CI 可能已经简化了它的 API,因为我已经设法让它只使用这个:
language: dart dart: - stable dart_task: - dartfmt install: - git clone https://github.com/flutter/flutter.git -b stable script: - ./flutter/bin/flutter doctor - ./flutter/bin/flutter test
-
- 我发现一个非常有用的资源是
.travis.ymlin the Flutter samples repo。不过,那里的设置对我来说似乎很复杂。 - 最接近我想要的结果类似于 Maurice McCabe 的Flutter unit, widget and integration testing with IOS and Android emulators on Travis-CI。
- 同样,这似乎过于复杂和过时了。
3。我心目中的草图
我之前提到的示例中的script 和install 步骤可以用jobs 替换为stages。这样,每个阶段将代表一种步骤。 Unit 和 Widget 一个阶段进行,Android 和 iOS 上的集成测试在另外两个阶段进行,这与 Maurice McCabe 和 Flutter 示例显示的类似。例如:
jobs:
include:
- stage: Flutter Test
language: dart
os: linux
install: git clone $FLUTTER_GITHUB -b stable
before_script:
- ./flutter/bin/flutter doctor
script:
- ./flutter/bin/flutter test
- stage: Integration Test on Android
os: linux
dist: trusty
language: android
android: # the things here are what probably needs to be fixed
components:
- build-tools-28.0.3
- android-28
install: git clone $FLUTTER_GITHUB -b stable
before_script:
- ./flutter/bin/flutter doctor
script:
- ./flutter/bin/flutter drive --target=test_driver/app.dart
如果我可以为dartfmt 任务创建一个stage,这在组织方面也会很好。
【问题讨论】:
标签: testing flutter continuous-integration integration-testing travis-ci