Creating a database integration test
In this section, we will create the skeleton of a database integration test using a test framework called DBRider. We will use this test to drive out the creation of a database table and database user. We will be working towards implementing the WordRepository
interface, which will access words stored in a Postgres database.
Previously, we created a domain model for our Wordz application, using hexagonal architecture to guide us. Instead of accessing a database directly, our domain model uses an abstraction, known as a port in hexagonal terminology. One such port is the WordRepository
interface, which represents stored words for guessing.
Ports must always be implemented by adapters in hexagonal architecture. An adapter for the WordRepository
interface will be a class that implements the interface, containing all the code needed to access the real database.
To test-drive this adapter code, we will write an integration test, using a library...