将测试目标添加到现有项目不起作用 [英] Adding test target to an existing project is not working
问题描述
我需要将测试用例添加到现有项目中,所以我尝试通过
I need to add test cases to an existing project, so I tried adding a new test target via
- 文件 - >新建 - >目标 - > Cocoa Touch测试包
- 来自测试导航器过滤器栏。
甚至添加后,目标未在测试筛选条中列出。
可能是因为这个问题,产品 - >测试
选项在我的项目中被禁用。
此外,我可以看到我的项目中的构建设置与我在Xcode 6.1中开始的另一个示例项目之间的差异,其中 Product - >测试
选项已启用且测试用例的一切正常。
Even after adding, the target is not getting listed in the test filter bar.
May be because of this issue, Product -> Test
option is diabled in my project.
Also I could see some differnce between the build setting in my project and another sample project I started in Xcode 6.1 in which Product -> Test
option is enabled and everything working fine for Test cases.
请找到构建设置屏幕截图。
Please find the build settings screen shots.
感谢任何帮助。
推荐答案
我遇到了这个问题。事实证明我的现有项目正在创建带有.app扩展名的Cocoa Touch测试包,它应该是.xctest扩展名。
I had this exact problem. It turns out my existing project was creating my Cocoa Touch Testing Bundle with the .app extension when it should've been a .xctest extension.
你可以通过去解决这个问题。到您创建的测试目标。 构建设置>包装扩展
并将其从 app
更改为 xctest
。
You can fix this by going to your test target you created. Build Settings > Wrapper Extension
and changing it from app
to xctest
.
您可能必须在此更改后重新启动Xcode才能选择您的测试目标。
You may have to restart Xcode after this change to select your test target.
更新:我发现了测试包的原因首先是 .app
扩展名。我不得不去主项目 Wrapper Extension
并确保它是空白而不是 .app
。显然,这也迫使所有目标成为 .app
扩展名。
UPDATE: I found out the reason the Testing Bundle was becoming a .app
extension in the first place. I had to go to the main project Wrapper Extension
and make sure it was blank instead of .app
. Apparently that was forcing all targets to become .app
extension as well.
这篇关于将测试目标添加到现有项目不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!