如何在目标c中编写自定义测试用例?(How to write customize test cases in objective c?)

编程入门 行业动态 更新时间:2024-10-23 18:33:52
如何在目标c中编写自定义测试用例?(How to write customize test cases in objective c?)

我可以在目标c中为测试用例自定义stassert语句吗?

Can I white my own customize stassert statements for test cases in objective c?

最满意答案

如果您正在进行集成测试或涉及多个不同组件之间交互的测试,我理解很难确认某些行为是否发生 - 因为行为可能被隐藏或甚至没有记录在主代码中。

一种解决方案是编写用于记录行为或将内部状态暴露给测试单元的代码,并使用#ifdef来包围这样的代码块。

您可以将预处理器宏添加到调试模式的应用程序目标(而不是测试目标)的构建设置中。 但这可能是混淆的潜在根源。

If you are doing integration testing, or testing that involves interaction between several different components, I understand that it is hard to confirm that certain behavior happened or not - since the behavior might be hidden or not even recorded in the main code.

One solution is to write code that to record behavior or expose internal state to the testing unit, and use #ifdef to surround such block of code.

You can add the preprocessor macro to the build setting of the app target (not the test target) for the Debug mode. This can be a potential source of confusion, though.

更多推荐

本文发布于:2023-08-06 19:43:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1454972.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:自定义   目标   测试   如何在   write

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!