Integration testing with data stores
One of the most common systems that you will interact with integration tests are data stores, and they require special handling.
The schema for your data stores should be treated like code and be tracked in a source control system like Git. This allows you to keep all the schema changes over time in sync with changes to code that works on data in that structure.
The database schema includes table structure, index definitions, views, and stored procedures. For a SQL-based database, these are defined in SQL script files. You should also consider reference data, which is data that should be inserted into the database to prepopulate it. For example, you might need to add about 200 rows to a CountryRegion
table used by your project for location lookups.
NoSQL databases like MongoDB and Couchbase are designed to handle unstructured or semi-structured data. Unlike SQL databases, they don’t enforce strict schemas. Data can be stored in formats like...