如何在xcode 4中每次构建(运行)ios app之前自动运行OCUnit逻辑测试? [英] How to run OCUnit logic tests automatically before each build (run) of ios app in xcode 4?

查看:132
本文介绍了如何在xcode 4中每次构建(运行)ios app之前自动运行OCUnit逻辑测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看来,我的一切设置正确。当我运行命令-u(或从菜单中选择产品 - 测试)时,测试运行正常。

It seems, that I have everything setup right. When I run command-u (or pick product - test from menu) test run fine.

最佳实践应该是,该测试应该尽可能频繁地运行,理想情况下每个构建(在每次运行期间理解)。

Best practices should be, that test should run as often as possible, ideally during each build (understand during each run).

如何强制XCode 4执行此操作?我试过:

How to force XCode 4 to do it? I have tried to:


  • 设置目标依赖项(将主应用程序目标设置为依赖于测试目标)

  • 在主应用目标构建设置中启用构建后测试

  • 勾选方案编辑器中的测试目标以运行主应用程序方案

但似乎没有任何效果。有没有人成功设置这个?

but nothing seems to work. Does anyone have success setting up this?

推荐答案

最后想出来了,虽然还不完美:

Finally figured it out, though still not perfect:


  1. 在测试目标上确保将构建后测试设置为是。

  2. 在您的主应用程序方案 - 构建 - 下runtick也测试包。

这使得您在运行应用程序时构建测试目标。感谢构建后测试,测试运行。如果一切正常,应用程序将以sim开头。如果有任何失败的测试,如果使用 STAssert ,则会出现崩溃。如果是 OCMock ,您可以检查日志检查器中到底出了什么问题。

This makes your test target build when running the app. Thanks to "Test after build" also the tests run. If everything is ok, app starts in sim. If there are any failing tests, you get a crash, if you use STAssert. In case of OCMock, you can check what exactly went wrong in log inspector.

有时断点不起作用。为了让他们工作,尝试产品 - 执行操作 - 测试而不构建。

Sometimes breakpoints do not work. To get them working try product - perform action - test without building.

这篇关于如何在xcode 4中每次构建(运行)ios app之前自动运行OCUnit逻辑测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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