什么是“单位"? [英] What is a "Unit"?

查看:163
本文介绍了什么是“单位"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在单元测试的上下文中,什么是单元"?

In the context of unit testing, what is a "unit"?

推荐答案

我通常通过单个方法将其定义为单个代码执行路径.这是根据经验法则得出的,即测试一种方法所需的单元测试数量等于或大于该方法的

I usually define it as a single code execution path through a single method. That comes from the rule of thumb that the number of unit tests required to test a method is equal to or greater than the method's cyclomatic complexity number.

这篇关于什么是“单位"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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