什么是单元测试,集成测试,冒烟测试和回归测试? [英] What are unit tests, integration tests, smoke tests, and regression tests?
问题描述
什么是单元测试,集成测试,冒烟测试和回归测试?它们之间有什么区别,我可以为每个工具使用哪些工具?
What are unit tests, integration tests, smoke tests, and regression tests? What are the differences between them and which tools can I use for each of them?
例如,我使用 JUnit 和
For example, I use JUnit and NUnit for unit testing and integration testing. Are there any tools for the last two, smoke testing or regression testing?
推荐答案
-
单元测试:指定并测试类的单一方法合约的一点.这应该具有非常狭窄且定义明确的范围.
已被存根或被嘲笑.
Unit test: Specify and test one point of the contract of single method of a class. This should have a very narrow and well defined scope. Complex dependencies and interactions to the outside world are stubbed or mocked.
集成测试:测试多个子系统之间的正确互操作.从两类之间的测试集成到与生产环境的测试集成,整个过程都有.
Integration test: Test the correct inter-operation of multiple subsystems. There is whole spectrum there, from testing integration between two classes, to testing integration with the production environment.
烟雾测试(又名 健全性 检查):一个简单的集成测试,我们只需检查一下即可当被测系统被调用时,它会正常返回并且不会崩溃.
Smoke test (aka sanity check): A simple integration test where we just check that when the system under test is invoked it returns normally and does not blow up.
- 烟雾测试都类似于电子产品,在第一次测试是在给电路加电时进行的(如果它冒烟,那就很糟糕!)...
- ...,显然,其中使用管道,其中管道系统的字面意思是烟雾然后目视检查.如果有任何冒烟,则表明系统存在泄漏.
- Smoke testing is both an analogy with electronics, where the first test occurs when powering up a circuit (if it smokes, it's bad!)...
- ... and, apparently, with plumbing, where a system of pipes is literally filled by smoke and then checked visually. If anything smokes, the system is leaky.
回归测试:修复错误后编写的测试.它确保不会再次发生此特定的错误.全名是非回归测试".也可以是在更改应用程序之前进行的测试,以确保应用程序提供相同的结果.
Regression test: A test that was written when a bug was fixed. It ensures that this specific bug will not occur again. The full name is "non-regression test". It can also be a test made prior to changing an application to make sure the application provides the same outcome.
为此,我将添加:
-
验收测试:测试功能或用例是否正确实现.它类似于集成测试,但侧重于提供的用例,而不是所涉及的组件.
Acceptance test: Test that a feature or use case is correctly implemented. It is similar to an integration test, but with a focus on the use case to provide rather than on the components involved.
系统测试:将系统测试为黑盒.在测试过程中,通常会嘲笑或打断对其他系统的依赖关系(否则,它更像是一个集成测试).
System test: Tests a system as a black box. Dependencies on other systems are often mocked or stubbed during the test (otherwise it would be more of an integration test).
飞行前检查:在类似生产环境中重复进行的测试,以减轻在我的机器上构建"综合征.通常,这是通过在类似产品的环境中进行验收或冒烟测试来实现的.
Pre-flight check: Tests that are repeated in a production-like environment, to alleviate the 'builds on my machine' syndrome. Often this is realized by doing an acceptance or smoke test in a production like environment.
这篇关于什么是单元测试,集成测试,冒烟测试和回归测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!