【问题标题】:running xctest from command line从命令行运行 xctest
【发布时间】:2014-03-14 20:18:43
【问题描述】:

我想为我的库创建逻辑测试并在​​ iOS 设备上运行它们。我知道我们只能在模拟器上运行它们。但我已经看到我可以在 iOS 设备上运行默认测试。这是设置。

  1. 使用 xcode 5 创建新的 iOS 7.0 应用(单视图应用,没什么花哨的)。
  2. 这将创建默认测试,该测试失败并显示消息 failed - No implementation for "-[MyAppTests testExample] 当您尝试运行它时。
  3. 我能够使用具有相同输出的 xcode 在模拟器和设备上运行此测试。

这是否意味着我也可以在设备上运行 XCTests?

此外,当我尝试使用命令行运行相同的测试时,它给我一个错误,说该方案不可测试。 Xcode 为何能够运行它?这是我在设备上执行的命令行。

xcodebuild test -scheme MyApp -configuration Debug -destination name=TestIPhone

我看到以下消息

2014-03-14 16:04:12.423 xcodebuild[620:1207] [MT] DVTAssertions: Warning in /SourceCache/IDEFoundation/IDEFoundation-3582/Framework/Classes/Model/Execution/RunContext/IDEScheme.m:1290 Details: Scheme <IDEScheme:0x7ff6abc8d2b0:'MyAppTests'> was asked to test, but it is not testable and shouldn't have allowed this action. Object: <IDEScheme: 0x7ff6abc8d2b0> Method: -testOperationWithExecutionContext:buildIfNeeded:onlyBuild:destination:overridingProperties:overridingTestingSpecifiers:buildLog:overridingBuildConfiguration:restorePersistedBuildResults:invocationRecord:name:title:error:actionCallbackBlock: Thread: <NSThread: 0x7ff6abc0e5d0>{name = (null), num = 1} Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide. xcodebuild: error: Failed to build project MyAppTests with scheme MyAppTests. Reason: Scheme "MyAppTests" is not testable.

任何见解都会有所帮助。我很困惑。

【问题讨论】:

    标签: xctest


    【解决方案1】:

    此问题已通过 Xcode5.1 更新解决。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-11-28
      • 1970-01-01
      • 2014-08-06
      • 2016-06-26
      • 2015-11-27
      • 2018-01-30
      • 2013-04-11
      • 2020-05-15
      相关资源
      最近更新 更多