Xcode - 调试单元测试目标 [英] Xcode - Debugging a unit test target

查看:194
本文介绍了Xcode - 调试单元测试目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用OCUnit为我的iPhone应用程序编写测试。
有没有办法调试单元测试,并有一个断点来看看发生了什么?



无需单独测试就可以很难写单元测试能够使用断点。

解决方案

对于Xcode 3是正确的。



对于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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆