Book Image

Test-Driven Java Development

Book Image

Test-Driven Java Development

Overview of this book

Table of Contents (17 chapters)
Test-Driven Java Development
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
8
Refactoring Legacy Code – Making it Young Again
Index

Integration tests


We did a lot of unit tests. We relied a lot on trust. Unit after unit was specified and implemented. While working on specifications, we isolated everything but the units we were working on, and verified that one invoked the other correctly. However, the time has come to validate that all those units are truly able to communicate with MongoDB. We might have made a mistake or, more importantly, we might not have MongoDB up and running. It would be a disaster to discover that, for example, we deployed our application, but forgot to bring up the DB, or that the configuration (IP, port, and so on) is not set correctly.

The integration tests' objective is to validate, as you might have guessed, the integration of separate components, applications, systems, and so on. If you remember the testing pyramid, it states that unit tests are the easiest to write and fastest to run, so we should keep other types of tests limited to things that UTs did not cover.

We should isolate our integration...