简体   繁体   English

重命名项目后XCTest目标未运行

[英]XCTest target is not running after project renaming

Before writing unit tests using XCTest framework my project was renamed from "osxapplication" to "My Application" in project settings as shown in example on screenshot below: http://jslim.net/images/posts/2015-01-08-how-to-rename-xcode-project-thoroughly/original.png 在使用XCTest框架编写单元测试之前,我的项目在项目设置中从“ osxapplication”重命名为“ My Application”,如以下屏幕截图示例所示: http : //jslim.net/images/posts/2015-01-08-how -to-重命名,Xcode的项目,彻底/ original.png

Also set "Product Name" to "My Application" in project settings. 另外,在项目设置中将“产品名称”设置为“我的应用程序”。

Then I created new target with wizard and "My Application Tests" target was added to the project. 然后,我使用向导创建了新目标,并将“我的应用程序测试”目标添加到了项目中。

The problem is that when I run test (using menu Product->Test) it launches my product (NOT unit tests) 问题是,当我运行测试(使用菜单产品->测试)时,它将启动我的产品(不进行单元测试)

How to solve the problem above? 如何解决以上问题?

I use Xcode 6.2 and Yosemite 10.10.2 我使用Xcode 6.2和Yosemite 10.10.2

通过在单元测试目标的构建设置中设置“测试主机”的确切路径,解决了上述问题

在此处输入图片说明

I'm just providing visual info to Sergio's answer. 我只是为Sergio的答案提供视觉信息。 Also, for anyone who wants to take deeper dive to test, it is better to go to the source itself. 此外,对于任何想更深入地进行测试的人来说,最好自己去了解源代码。 The image was taken from apple's documentation at : https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/testing_with_xcode/chapters/05-running_tests.html 该图像取自Apple的文档, 网址为: https : //developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/testing_with_xcode/chapters/05-running_tests.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM