我研究了应用程序中心,由于某种原因它不适用于我们当前的设置。
我已经为来自 Xcode 的 swift 代码创建了一个构建管道。我也上传了我的单元和用户界面测试。我想创建一个脚本来触发 azure devops 中的测试运行。这可能吗?我还想确保运行测试是 headless 的。
最佳答案
虽然this page仅描述使用App Center Test task在您的管道中,还可以使用 Xcode task 运行测试,通过使用 test
操作。
下面是在 iPad Air 模拟器上运行 MyScheme 测试并将结果存储为 JUnit 格式的示例:
- task: Xcode@5
displayName: 'Running tests'
inputs:
actions: 'test'
sdk: 'iphonesimulator'
configuration: 'Debug'
xcWorkspacePath: 'MyWorkspace.xcworkspace'
scheme: 'MyScheme'
xcodeVersion: 'default'
useXcpretty: true
publishJUnitResults: true
args: '-destination "platform=iOS Simulator,name=iPad Air (4th generation)"'
然后您可以使用 Publish Test Results task 发布结果:
- task: PublishTestResults@2
displayName: 'Publishing test results'
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '**/junit.xml'
mergeTestResults: true
failTaskOnFailedTests: true
一些额外的背景知识:Xcode 任务的文档说您应该能够使用 destinationPlatformOption
、destinationPlatform
和 指定目标targetSimulators
参数,但我发现它们无法正确转义结果,因此我恢复使用上面显示的任务的 args
参数。
无论如何,我希望这对某人有帮助。
关于ios - 有没有办法使用 iOS 运行 azure devops 的单元和 ui 测试?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55368889/