Chapter 8. Docker and testing
This chapter covers
- Handling difficulties with high-level tests
- Understanding how Docker can help you with testing
- Creating reproducible testing environments
- Working with Arquillian Cube
A recurring message delivered by this book, and a message most developers would agree with, is that a high-level test implies a slower test—and that a huge amount of effort is usually required to prepare the test environment in which to run it. You encountered this in chapter 5, where you learned that to write an integration test against a database, you need an environment with the database you’re going to use in production. The same thing happened in chapter 7, where you saw that you might need one or more microservices deployed along with their databases. And in the case of a web frontend, you might also need specific browsers installed.
When you want to test the application’s big picture, you need more pieces in your environment to make it run. Here are a few:
- Databases
- Other microservices
- Multiple browsers
- Distributed caches
The problem is that first, you need to define your test environment; and second, you must provide a runtime under which to run this configuration. This probably won’t be your development machine, a disadvantage for a developer because you’ll lose the possibility of reproducing or debugging any given problem locally. Remote debugging, although not impossible, is much more complex.