What is Unit test, Integration Test, Smoke test, Regression Test?

What is Unit test, Integration Test, Smoke test, Regression Test and what are the differences between them? And Which tools can I use for each of them?

For example I use JUnit and NUnit for Unit testing and Integration Testing. Are there any Smoke Test or Regression Test tools?


  • 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. It is an analogy with electronics, where the first test occurs when powering up a circuit: if it smokes, it's bad.

  • 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.

  • To this, I will add:

  • 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

  • PS: People claim smoke testing comes from plumbing where smoke is pumped in the system of pipes before it's connected to the water supply. If any smoke comes out, the pipes are not properly sealed. It might be more historically accurate, but I find it is less funny.


  • Unit test : an automatic test to test the internal workings of a class. It should be a stand-alone test which is not related to other resources.
  • Integration test : an automatic test that is done on an environment, so similar to unit tests but with external resources (db, disk access)
  • Regression test : after implementing new features or bug fixes, you re-test scenarios which worked in the past. Here you cover the possibility in which your new features break existing features.
  • Smoke testing : first tests on which testers can conclude if they will continue testing.

  • Everyone will have slightly different definitions, and there are often grey areas. However:

  • Unit test: does this one little bit (as isolated as possible) work?
  • Integration test: do these two (or more) components work together?
  • Smoke test: does this whole system (as close to being a production system as possible) hang together reasonably well? (ie are we reasonably confident it won't create a black hole?)
  • Regression test: have we inadvertently re-introduced any bugs we'd previously fixed?
  • 链接地址: http://www.djcxy.com/p/21408.html

    上一篇: 单元测试控制器

    下一篇: 什么是单元测试,集成测试,烟雾测试,回归测试?