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

Enc*_*PTL 2 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 **
Run Code Online (Sandbox Code Playgroud)

由于某种原因,它无法获取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
Run Code Online (Sandbox Code Playgroud)

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

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

在此输入图像描述

在此输入图像描述

小智 6

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

在我的情况下,我跑了

xcodebuild -version

它返回以下内容:

Xcode 5.1.1构建版本5B1008

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

在此输入图像描述

之后,您可以使用确认命令行工具版本

xcodebuild -version

你应该回来

Xcode 6.0 Build版本6A267n

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