Xcode5: creating new testing target

这一生的挚爱 提交于 2019-12-12 05:00:02

问题


I'm trying to create my first XCTestCase within my existing iOS+Mac project. I created a new test class, and I see that it created a new test target for me in my project, but the new scheme has none of the linked libraries and source code files from my existing target. It just shared the scheme from the existing target, but none of the project details. I don't want to go add each and every source file and framework library into the new test target. Is there a way to simply create a new test target that is a clone of an existing target? Or add all source files into my target without it being


回答1:


When set up correctly, the test bundle is linked against your app. You shouldn't put any production code into your test target, only test code.




回答2:


I was probably doing something wrong in how I setup the test target. You can create a new test Target, (from New -> Target -> Unit Testing Bundle), set it up from an existing target, and it should build and link just fine, and you can import any existing files into the test class.



来源:https://stackoverflow.com/questions/22870078/xcode5-creating-new-testing-target

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!