【问题标题】:Running integration testing for Flutter on Azure Devops pipeline for UI automation testing在 Azure Devops 管道上运行 Flutter 集成测试以进行 UI 自动化测试
【发布时间】:2021-03-08 10:05:40
【问题描述】:
我想在 Azure Devops Pipelines 上使用 Flutter 驱动程序运行自动化 UI 测试,我正在使用 Flutter Tasks by Alois Daniel。 azure Flutter 任务插件上目前没有 Flutter 驱动程序支持。我们正在寻找可以在运行 Flutter 驱动程序测试时启动 Android 和 iOS 模拟器的任务。我们正在 azure devops 管道 yml 文件中为 macos-latest 运行 vm-image。
【问题讨论】:
标签:
azure-devops
azure-pipelines
flutter-test
【解决方案1】:
为了实现我想要做的事情,我使用以下代码创建了一个文件,并添加了脚本功能将其推送到项目中
# DO NOT RUN ON YOUR LOCAL MACHINE
echo "install xcode in command line"
xcode-select --install
echo "install home brew"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
echo "install flutter using brew"
brew install --cask flutter
echo "starting up apple emulator"
flutter emulators --launch <apple_ios_simulator/android emulator>
echo "awaiting for emualator to load"
sleep 5
echo "starting integration tests"
flutter drive --target=test_driver/<yourtestfile>.dart
通过从开发操作的侧面板拖放,在 azure-pipeline yml 中将其作为 bash 脚本调用。运行它,你会看到它工作。
一些限制是当涉及到需要用户权限的 android/ios 模拟器上的系统对话框时,您可以关注它here。
对于 iOS,有一个名为 AppleSimulatorUtils
的工具
【解决方案2】:
没有这样的内置扩展来满足您的需要。
作为替代方案,您可以创建自己的扩展程序,建议您查看以下文章来做到这一点: