I was talking with a colleague on the way home, when we started talking about his troubles with his bike.
In short, he could turn the pedals like crazy, and the bike was not moving an inch.
That's when I realized that this is a perfect example of the difference between Unit Testing and Integration Testing.
In short:
- unit test
write a unit test, to see if we can properly turn the pedals in the proper direction.
Conclusion: Success! Software works fine. In fact it works extremely well. We achieved a performance increase of over 500%! Yay!
- integration test
write an integration test, to see if when we turn the pedals, the bicycle will move.
Conclusion: Failure! Pedals turn fine, but the bicycle doesn't move.
It turns out the integration between the component "pedals" and the component "wheels" was busted.
It totally shows that though Unit tests may all pass, it is not a guarantee that your software is actually doing what it should.
Lesson learned.