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.
- Unit tests check one module; integration tests check modules combined ✔
- Unit tests are run by users; integration tests by computers
- 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.
My unit tests all passed, but together they failed. Like a band where everyone plays a different song.
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.
- 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. - 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. - 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.
More stuff everyone should know
That's stuff everyone should know.