What is the difference between a unit test and an integration test?

A unit test checks one module alone; an integration test checks modules together.

Start playing free

  1. Unit tests check one module; integration tests check modules combined ✔
  2. Unit tests are run by users; integration tests by computers
  3. They are two names for the same thing

Why: Unit tests isolate one piece, so a failure points right at it. Integration tests combine pieces, or the whole program, to catch problems in how they work together. Good projects use both.

Huh, didn't know that: Running all your tests after every change is called regression testing; it catches old bugs that sneak back in.

The dad joke
My unit tests all passed, but together they failed. Like a band where everyone plays a different song.
Like this card?
Play the game

References

Answer: Unit tests check one module; integration tests check modules combined. Unit tests isolate one piece, so a failure points right at it. Integration tests combine pieces, or the whole program, to catch problems in how they work together. Good projects use both.

  1. MIT 6.031 Software Construction, Reading 3: Testing web.mit.edu/6.031/www/sp22/classes/03-testing
    A test that tests an individual module, in isolation if possible, is called a unit test.
    Checked 2026-10-10.
  2. MIT 6.031 Software Construction, Reading 3: Testing web.mit.edu/6.031/www/sp22/classes/03-testing
    an integration test tests a combination of modules, or even the entire program
    Checked 2026-10-10.
  3. Python docs: unittest docs.python.org/3/library/unittest.html
    A test fixture represents the preparation needed to perform one or more tests, and any associated cleanup actions.
    Checked 2026-10-10.

Think this answer is wrong? Tap "Challenge this answer" on the card in the game and tell us why.

Test yourself in the game