xcode xcodebuild 测试未运行 XCTestCase 单元测试文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24224193/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
xcodebuild test not running XCTestCase unit test file
提问by Encore PTL
Not able to run the unit test file using xcodebuild test -scheme DollarTests -project Dollar.xcodeproj -configuration Debug -sdk macosx
无法使用运行单元测试文件 xcodebuild test -scheme DollarTests -project Dollar.xcodeproj -configuration Debug -sdk macosx
Below is the output of the command
下面是命令的输出
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 **
For some reason it is not able to pick up the XCTestCase files and I get the following warning
由于某种原因,它无法获取 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
The test files are in Swift, so it that the issue and how can I resolve it to include these and run these file when running test.
测试文件在 Swift 中,因此问题以及如何解决它以包含这些文件并在运行测试时运行这些文件。
Attaching screenshots of the configuration and files I have in the project
附上我在项目中的配置和文件的截图
回答by Terry Rice
I had this same problem when building my project from the command line. The problem is likely that the command line tools are configured to use a version prior to Xcode 6. This was the case with my configuration.
从命令行构建我的项目时,我遇到了同样的问题。问题很可能是命令行工具被配置为使用 Xcode 6 之前的版本。我的配置就是这种情况。
In my case I ran
就我而言,我跑了
xcodebuild -version
xcodebuild -version
and it returned the following:
它返回以下内容:
Xcode 5.1.1 Build version 5B1008
Xcode 5.1.1 构建版本 5B1008
So then I went to Xcode Preferences as show below and picked the version 6 command line tools and the problem went away.
然后我转到如下所示的 Xcode Preferences 并选择了第 6 版命令行工具,问题就消失了。
After that you can confirm the command line tools version by using
之后,您可以使用以下命令确认命令行工具版本
xcodebuild -version
xcodebuild -version
and you should get back
你应该回来
Xcode 6.0 Build version 6A267n
Xcode 6.0 构建版本 6A267n
or a similar value depending on which beta you currently have installed.
或类似的值,具体取决于您当前安装的测试版。