【问题标题】:How do you configure the XCode Jenkins plugin to run tests?你如何配置 XCode Jenkins 插件来运行测试?
【发布时间】:2013-08-23 16:10:17
【问题描述】:

使用 Jenkins XCode 插件运行测试的说明说要设置测试目标(我已经完成)、SDK(我已经完成)和配置(我什么都没试过、调试和测试) )。

但是我不断收到“...未配置为运行”。

我如何真正让它运行测试?

这是输出:

+ xcodebuild -workspace /Users/MyDir/.Jenkins/jobs/MyTests/workspace/folder/MyWorkspace.xcworkspace -scheme MyTestScheme clean
xcodebuild: error: Failed to build workspace MyWorkspace with scheme MyTestScheme.
    Reason: Scheme "MyTestScheme" is not configured for running.

如果在 MyTestScheme 的 XCode 中,如果我选择 Product/Run,则会收到相同的错误消息,但如果我选择 Product/Test,则测试代码会成功执行。在 Xcode 中成功运行的输出是:

2013-08-28 11:10:25.828 otest[65917:303] Unknown Device Type. Using UIUserInterfaceIdiomPhone based on screen size
Test Suite 'Multiple Selected Tests' started at 2013-08-28 18:10:26 +0000
Test Suite '/Users/MyDir/Library/Developer/Xcode/DerivedData/MyWorkspace-ctngidolzdhijvbymvghygtoaiiw/Build/Products/Debug-iphonesimulator/MyTestScheme.octest(Tests)' started at 2013-08-28 18:10:26 +0000
Test Suite 'MyTests' started at 2013-08-28 18:10:26 +0000
Test Case '-[MyTests test1]' started.
2013-08-28 11:10:26.029 otest[65917:303] MDN: (null)
Test Case '-[MyTests testA1]' passed (0.346 seconds).

【问题讨论】:

    标签: xcode jenkins jenkins-plugins


    【解决方案1】:

    对我来说,问题在于使用测试模式。应改为使用调试模式。

    【讨论】:

      【解决方案2】:

      要为单元测试配置 Xcode 插件,您需要在“Advanced Xcode build options”内的“Custom xcodebuild arguments”字段中编写“test”。

      【讨论】:

        【解决方案3】:

        XCode 插件维护者在这里。我不知道答案,但我很乐意帮助你。

        你试过摆弄目标参数吗?

        例如-destination 'OS=8.0,name=iPhone'-destination 'platform=iOS Simulator,OS=8.0,name=iPhone 6s'

        (根据需要调整)

        如果这不起作用,请尝试从 XCode 本身复制运行测试生成的输出。

        【讨论】:

        • 你好。目的地是 Xcode Jenkins 插件中的设置吗?如果是这样,我在任何地方都看不到它。如果它是您所指的自定义 xcodebuild 参数部分,我尝试过但没有成功。我已将输出添加到我的帖子中。
        • 再次请复制成功运行xcode的输出。您缺少一些参数来正确触发测试方案
        • 您能否详细说明如何在插件中使用 -destination 参数?我试图将它添加到我的 jenkinsfile 但收到错误“WorkflowScript:162:无效参数“目标”,您的意思是“配置”吗?”
        猜你喜欢
        • 2012-02-25
        • 1970-01-01
        • 2013-04-03
        • 2015-05-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-06-14
        • 1970-01-01
        相关资源
        最近更新 更多