xcodebuild测试没有运行XCTestCase单元测试文件

时间:2014-06-14 20:51:29

标签: xcode xcodebuild

无法使用xcodebuild test -scheme DollarTests -project Dollar.xcodeproj -configuration Debug -sdk macosx

运行单元测试文件

以下是命令的输出

xcodebuild test -scheme DollarTests -project Dollar.xcodeproj -configuration Debug -sdk macosx
Build settings from command line:
    SDKROOT = macosx10.9

2014-06-14 16:43:29.537 xcodebuild[3504:92734] stream error: stream error at offset 29: created by an unsupported XCDependencyGraph build
2014-06-14 16:43:29.540 xcodebuild[3504:92735] stream error: stream error at offset 29: created by an unsupported XCDependencyGraph build
=== BUILD TARGET Dollar OF PROJECT Dollar WITH CONFIGURATION Debug ===

Check dependencies
warning: no rule to process file '/Users/ankur/Personal/Dollar/Dollar/Dollar.swift' of type text for architecture x86_64
OS X deployment target '10.10' for architecture 'x86_64' and variant 'normal' is greater than the maximum value '10.9' for the OS X 10.9 SDK.

=== BUILD TARGET DollarTests OF PROJECT Dollar WITH CONFIGURATION Debug ===

Check dependencies
warning: no rule to process file '/Users/ankur/Personal/Dollar/DollarTests/DollarTests.swift' of type text for architecture x86_64
warning: no rule to process file '/Users/ankur/Personal/Dollar/DollarTests/CarExample.swift' of type text for architecture x86_64
OS X deployment target '10.10' for architecture 'x86_64' and variant 'normal' is greater than the maximum value '10.9' for the OS X 10.9 SDK.

Test Suite 'All tests' started at 2014-06-14 20:43:30 +0000
Test Suite 'All tests' finished at 2014-06-14 20:43:30 +0000.
Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.001) seconds
** TEST SUCCEEDED **

由于某种原因,它无法获取XCTestCase文件,我收到以下警告

warning: no rule to process file '/Users/ankur/Personal/Dollar/DollarTests/DollarTests.swift' of type text for architecture x86_64
warning: no rule to process file '/Users/ankur/Personal/Dollar/DollarTests/CarExample.swift' of type text for architecture x86_64

测试文件在Swift中,所以问题是如何解决它以包含这些并在运行测试时运行这些文件。

附上我在项目中的配置和文件的屏幕截图

enter image description here

enter image description here

1 个答案:

答案 0 :(得分:6)

从命令行构建项目时遇到同样的问题。问题可能是命令行工具配置为使用Xcode 6之前的版本。我的配置就是这种情况。

就我而言,我跑了

  

xcodebuild -version

并返回以下内容:

  

Xcode 5.1.1   构建版本5B1008

然后我去了Xcode Preferences,如下图所示,选择了6版命令行工具,问题就消失了。

enter image description here

之后,您可以使用

确认命令行工具版本
  

xcodebuild -version

你应该回来

  

Xcode 6.0   构建版本6A267n

或类似值取决于您当前安装的测试版。