在 Azure Devops 管道上运行 Flutter 集成测试以进行 UI 自动化测试

Lob*_*obo 3 azure-devops azure-pipelines flutter-test

我想在 Azure Devops Pipelines 上使用 flutter 驱动程序运行自动化 UI 测试,并且我正在使用Alois Daniel 的 Flutter Tasks。azure flutter 任务插件目前不支持 flutter 驱动程序。我们正在寻找在运行 flutter 驱动程序测试时启动 Android 和 iOS 模拟器的任务。我们正在 azure devops pipeline yml 文件中运行 macos-latest 的 vm-image。

Lob*_*obo 7

为了实现我想做的事情,我使用以下代码创建了一个文件,并添加了脚本功能将其推送到项目中

# 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
Run Code Online (Sandbox Code Playgroud)

通过从开发操作的侧面板拖放,在 azure-pipeline yml 中将其作为 bash 脚本调用。运行它,你会看到它工作了。一些限制是,当涉及到 android/ios 模拟器上的系统对话框时,需要用户许可,您可以在此处遵循。对于 iOS,有一个名为AppleSimulatorUtils的工具

在此输入图像描述