【发布时间】:2020-03-17 09:27:36
【问题描述】:
'Module was not compiled for testing' when using @testable 无法解决此帖子问题。
我正在使用 jenkins 和 fastlane 将 Xcode 项目与 CI/CD 集成。如果项目没有测试用例,我的 Xcode 项目构建成功。如果我添加了我的测试用例,那么 jenkins 中的 xcode 构建失败并出现错误:
错误:模块“JenkinsFastlaneExample”未编译用于测试
错误截图
在一篇帖子中,我发现 answer 设置了方案标志,我做了同样的回答,但对我不起作用。
我的测试用例在 Xcode 11.x , iOS 13.x 也成功了。在 iPhone XR 中测试
我无法找出 jenkins 构建失败的原因。
演示回购(如果需要): https://github.com/thedahiyaboy/ios_jenkins_example
编辑:
我还尝试从 Xcode 禁用我的测试用例,以便我只能从 mac 系统运行我的用例,并希望 jenkins 会跳过测试包,但会遇到同样的问题。
【问题讨论】:
-
看起来你的测试没有编译(可能),你可以在本地运行它们吗?
-
@Scriptable 是的,在本地 xcode 中是成功的。我添加了相同的屏幕截图。
-
你有 .gitignore 文件吗?
-
@Scriptable 是的,我有。我从 github 中为 swift 项目选择了默认的
.gitignore。 -
有可能(如果我没记错的话)你的测试方案定义被 git 忽略了。删除 .gitignore 中包含 xcshareddata 的行。做
git add .,提交并推送。那就试试
标签: ios xcode jenkins continuous-integration fastlane