JUnit 中的失败和错误有什么区别? [英] What's the difference between failure and error in JUnit?

查看:30
本文介绍了JUnit 中的失败和错误有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在大型代码库上运行 JUnit 测试,我意识到有时会出现错误",而有时会出现失败".有什么区别?

I'm running JUnit tests on a large code base, and I've been realizing that sometimes I get "Errors" while other times I get "Failures". What's the difference?

推荐答案

失败似乎是当你的测试用例失败时——即你的断言不正确.错误是在尝试实际运行测试时发生的意外错误 - 异常等.

It seems that failures are when your test cases fail – i.e. your assertions are incorrect. Errors are unexpected errors that occur while trying to actually run the test – exceptions, etc.

这篇关于JUnit 中的失败和错误有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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