Unit test vs. Integration test

Chuck Greb
Android Testing
Published in
1 min readJan 4, 2017
https://twitter.com/codejobs/status/813056723271450624

Still confused about the difference between a unit test and and integration test?

Both are important tiers of the test pyramid.

Unit tests

Integration tests

  • Run reasonably fast. Anywhere from a few seconds to a minute
  • Test how your code interacts with the framework
  • May or may not mock external dependencies
  • May access a local database or filesystem or network
  • May or may not run in parallel
  • Should NOT be used to practice TDD

Even a few seconds is too slow to get the rapid feedback required for TDD.

Integration tests are a nice second layer of defense that should be run regularly for example on a CI server. They can catch issues that might have been missed in the unit tests and offer a more realistic test environment.

--

--

Chuck Greb
Android Testing

Mission-driven engineering leader. Community organizer. Digital minimalist.