OGeek|极客世界-中国程序员成长平台

标题: ios - 使用 Jenkins 对 iOS 进行单元测试 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 12:17
标题: ios - 使用 Jenkins 对 iOS 进行单元测试

我正在尝试使用 jenkins 自动化我的 iOS 项目。 但是,我想用 jenkins 测试的项目遇到问题。

该项目名为 ttt 并使用 cocoapods,因此它也有一个名为 ttt 的工作区。

查看项目中存在的以下方案。 enter image description here

我关注了this教程。

我所做的设置如下 enter image description here

enter image description here

enter image description here

当我尝试运行它时,它会卡在这里!

Going to invoke xcodebuild:, scheme: ttt, sdk: DEFAULT, workspace: ttt, configuration: Debug, clean: NO, archive:NO, symRoot: DEFAULT, configurationBuildDir: DEFAULT, codeSignIdentity: DEFAULT
[lbp-iOS] $ /usr/bin/xcodebuild -scheme ttt -workspace ttt.xcworkspace -configuration Debug build test -destination "platform=iOS Simulator,name=iPhone 6,OS=10.1"

当我从工作区字段中删除 ttt 时,我收到以下错误

Going to invoke xcodebuild:, scheme: ttt, sdk: DEFAULT, project: DEFAULT, configuration: Debug, clean: NO, archive:NO, symRoot: DEFAULT, configurationBuildDir: DEFAULT, codeSignIdentity: DEFAULT
[lbp-iOS] $ /usr/bin/xcodebuild -scheme ttt -configuration Debug build
xcodebuild: error: The project named "ttt" does not contain a scheme named "ttt". The "-list" option can be used to find the names of the schemes in the project.
Build step 'Xcode' marked build as failure
Recording test results



Best Answer-推荐答案


好吧,为什么它不起作用与该方案实际上并未发送到 git 的事实有关。 您需要在 xcode 项目中指定它,否则它甚至不会显示为您可以提交的文件。

为此,请转到 xcode > Product > Scheme > Manage Schemes
您将看到一个屏幕,其中包含项目中的所有方案,请确保勾选 Shared 下的框,以获取您想在 Jenkins 中使用的所有方案。

enter image description here

将此推送到您的 git 并重试。它现在应该可以工作了。

关于ios - 使用 Jenkins 对 iOS 进行单元测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40536087/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4