您现在的位置是:首页 > 电脑 > 

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

2025-07-19 15:29:21
如何在目标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?
如何在目标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.

#感谢您对电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格的认可,转载请说明来源于"电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格

本文地址:http://www.dnpztj.cn/diannao/697380.html

相关标签:无
上传时间: 2023-08-27 09:49:40
留言与评论(共有 11 条评论)
本站网友 子宫内膜厚
4分钟前 发表
您可以将预处理器宏添加到调试模式的应用程序目标(而不是测试目标)的构建设置中
本站网友 公分等于厘米吗
8分钟前 发表
并使用#ifdef来包围这样的代码块
本站网友 逸翠园
17分钟前 发表
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
本站网友 厕所门
22分钟前 发表
并使用#ifdef来包围这样的代码块
本站网友 广州艺术博览会
4分钟前 发表
但这可能是混淆的潜在根源
本站网友 上海新村路
24分钟前 发表
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
本站网友 温水中的青蛙
0秒前 发表
如何在目标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? 最满意答案 如果您正在进行集成测试或涉及多个不同组件之间交互的测试
本站网友 广州餐厅
4分钟前 发表
但这可能是混淆的潜在根源
本站网友 完美的英文
21分钟前 发表
If you are doing integration testing
本站网友 置换贴图
20分钟前 发表
一种解决方案是编写用于记录行为或将内部状态暴露给测试单元的代码