tags:

views:

7240

answers:

8

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,NUnit for Unit testing and Integration Testing. Are there any Smoke Test,Regression Test tools?

+16  A: 
  • 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.
Gerrie Schenck
Regression test's definition isn't really exactly how it is. @ddaa defines it correctly.
Robert Koritnik
+3  A: 

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? (i.e. are we reasonably confident it won't create a black hole?)
  • Regression test: have we inadvertently re-introduced any bugs we'd previously fixed?
Jon Skeet
+1  A: 

In a previous life I was an electronic engineer. A smoke test was that time you first switched on your prototype. Flick the switch and sniff around for the smell of burning.

(There were some technicians who liked to add a little surprise - an electrolytic capactitor soldered the wrong way round to the back of the board. Makes a nice bang and a bit of mess...)

paul
+5  A: 

apocryphal historical trivia: "smoke testing" comes from submarine engineering (inherited from plumbing) where literal smoke would be pumped into the hull to see if any of it came out again, which would be rather a dramatic failure for a submarine!

annakata
+18  A: 
  • 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: 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 ensure that this specific bug will not occur again. The full name is "non-regression test".

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.
ddaa
Your so called **Feature test** is usually called **Acceptance test**.
Robert Koritnik
Thank you. I edited my answer.
ddaa
I like the background on why we call them smoke tests. Made me chuckle.
AndyM
A: 

Some good answers already but I would like further refine them:

Unit testing is the only form of white box testing here. The others are black box testing. White box testing means that you know the input, you know the inner workings of the mechanism and can inspect it and you know the output. With black box testing you only know what the input is and what the output should be.

So clearly unit testing is the only white box testing here.

  • Unit testing test specific pieces of code. Usually methods.
  • Integration testing test whether your new feature piece of software can intergrate with everything else.
  • Regression testing. This is testing done to make sure you haven't broken anything. Everything that used to work should still work.
  • Smoke testing is done as a quick test to make sure everything looks okay before you get involved in the more vigorous testing.
uriDium
Unit testing is not necessarily white-box. Some of the best unit tests I've seen are essentially examples drawn from the requirements, specifying expected results independently from any implementation concepts.
joel.neely
added to that, your unit tests are included in your regression tests therefore regression tests are neither white or black box tests. I'd go as far to say that even integration and smoke tests can be either white- or blackbox tests.
Lieven
+2  A: 

Unit test: Verifying that particular component (i.e.,class) created or modified functions as designed. This test can be manual or automated but does not move beyond the boundary of the component.

Integration test: Verifying that the interaction of particular components function as designed. Integration tests can be performed at the unit level or the system level. These tests can be manual or automated.

Regression test: Verifying that new defects are not introduced into existing code. These tests can be manual or automated.

Depending upon your SDLC (waterfall, rup, agile, etc) particular tests may be performed in 'phases' or may all be performed, more or less, at the same time. For example, unit testing may be limited to developers who then turn the code over to testers for integration and regression testing. However another approach might have developers doing unit testing and some level of integration and regression testing (using a TDD approach along with continuous integration and automated unit and regression tests).

The tool set will depend largely on the codebase but there are many open source tools for unit testing (JUnit). HP's (mercury) QTP or Borland's Silktest are both tools for automated integration and regression testing.

rdrex
A: 

REGRESSION TESTING-

"A regression test re-runs previous tests against the changed software to ensure that the changes made in the current software do not affect the functionality of the existing software."

Nikita G