|
Post by Mitu46544 on Nov 8, 2023 22:21:07 GMT -8
的移动部分需要考虑发生的情况如下帖子和响应对象被模拟。和方法的响应被嘲笑。该函数的实现是模拟的以便您可以向交互式事务函数提供模拟的客户端而不是实际的客户端实例。该方法被调用。验证响应的值以确保交互式事务中的业务逻辑正常工作。更具体地说它确保新帖子的标志设置为。监视方法您将探索的最后一个概念是间谍活动。通过名为的包使您能够监视函数。通过监视您可以在代码执行过程中观察函数并确定。 数传递给它的参 马来西亚电话号码表 数它返回的值等等。注意监视函数允许您在执行代码时观察有关该函数的详细信息而无需修改目标函数或其行为。您可以使用来监视未模拟的函数但是默认情况下模拟函数具有所有可用的监视功能。由于已被嘲笑因此每个功能都应该能够被监视。间谍功能。下面是使用间谍进行测试的简单示例测试功能复制当您尝试确保根据各种输入触发某些场景时这些间谍功能特别有用为什么选择维。 泰斯特您可能会好奇为什么本文重点关注作为测试框架而不是像这样更成熟和流行的框架。这一决定背后的原因与不同工具与的兼容性有关特别是在处理对象时。技术指导委员会成员在他最近的直播中很好地描述了这个问题并取得了其他令人惊叹的成就。简而言之问题是无法开箱即用地确定错误是否是该类的实例。当您在应用程序中为不同情况编写测试时这可能会导致各种意外问题。它们有何不同幸运的是在大多数情况下每个。
|
|