Go to the content


 Go back to Planet Debian
Full screen Suggest an article

Lars Wirzenius: Unit and integration testing: an analogy with cars

November 12, 2017 23:12 , by Planet Debian - 0no comments yet | No one following this article yet.
Viewed 17 times

A unit is a part of your program you can test in isolation. You write unit tests to test all aspects of it that you care about. If all your unit tests pass, you should know that your unit works well.

Integration tests are for testing that when your various well-tested, high quality units are combined, integrated, they work together. Integration tests test the integration, not the individual units.

You could think of building a car. Your units are the ball bearings, axles, wheels, brakes, etc. Your unit tests for the ball bearings might test, for example, that they can handle a billion rotations, at various temperatures, etc. Your integration test would assume the ball bearings work, and should instead test that the ball bearings are installed in the right way so that the car, as whole, can run a kilometers, and accelerate and brake every kilometer, uses only so much fuel, produces only so much pollution, and doesn't kill passengers in case of a crash.

Source: http://blog.liw.fi/posts/2017/11/13/unit_and_integration_testing_an_analogy_with_cars/

0no comments yet

Post a comment

The fields are mandatory.

If you are a registered user, you can login and be automatically recognized.