Xcode - 调试单元测试目标 [英] Xcode - Debugging a unit test target
问题描述
有没有办法调试单元测试,并有一个断点来看看发生了什么?
无需单独测试就可以很难写单元测试能够使用断点。
对于Xcode 4,事情要简单得多。编辑您当前的方案并转到测试操作。单击底部的+,并添加包含要运行的测试的测试包。现在当您选择产品 - >测试时,它将运行这些测试。任何有效的断点将按照您的期望被击中。
I am writing tests for my iPhone app using OCUnit. Is there any way to debug the unit tests and have a break point to see what the heck is happening?
It's ridiculously hard to write unit tests without being able to use breakpoints.
The link posted by David Gelhar is correct for Xcode 3.
For Xcode 4, things are much simpler. Edit your current scheme and go to the "Test" action. Click the '+' at the bottom and add the test bundle that contains the tests you want to run. Now when you choose Product -> Test, it will run those tests. Any active breakpoints will be hit just like you'd expect.
这篇关于Xcode - 调试单元测试目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!