From the course: Advanced Spring: Effective Integration Testing with Spring Boot

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Effective ways to test your data access

Effective ways to test your data access

From the course: Advanced Spring: Effective Integration Testing with Spring Boot

Start my 1-month free trial

Effective ways to test your data access

- [Instructor] Writing tests for all database interactions can be tedious. How to choose which interactions to mock and which test, what risks are we introducing with custom queries, having in-memory databases, and how to avoid common pitfalls. Let's explore three keys to write an effective integration test for the database layer. But first, let's understand spring boot data support and common ways of interacting with our persistence layer in spring applications. Spring boot comes with a variety of spring data projects to work with SQL and NoSQL databases, such as document, graph, and search. We also get extensive support to interact with our database from direct Jdbc access using data source or Jdbc template. Up to complete ORM such as hibernate where we work with entity managers or repositories. Spring data also provides different ways to create a DB schema. From writing SQL scripts or using DB migration tools such as flyway or Liquibase, to simplest autocreation based owner…

Contents