ios - 使用 Jenkins 对 iOS 进行单元测试

标签 ios xcode unit-testing jenkins

我正在尝试使用 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

最佳答案

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

为此,请转到 xcode > 产品 > 方案 > 管理方案
您将看到一个屏幕,其中包含项目中的所有方案,请确保选中您想要在 Jenkins 中使用的所有方案的 Shared 下的框,如下所示。

enter image description here

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

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

相关文章:

ios - setState 在 iOS 上的工作效果与在 Android 上不同

c++ - 我可以更改Xcode创建 Playground 的语言吗?

c# - 如何使用 AutoFixture 在保留类型自定义的同时使用自定义属性进行构建?

unit-testing - 单元测试能否成功添加到现有的生产项目中?如果是这样,如何以及是否值得?

iPhone开发单元测试链接问题

ios - 右约束在 iphone SE 上无法正常工作

ios - 子类化 MKGeodesicPolyline

android - 如何使用不同的屏幕分辨率

ios - 在单独的 UICollection 类中使用未解析的标识符 'UICollection'

ios - SWRevealController 不适用于 NavigationController