Sql Scripts For Creation Of Same Table In Repository Tests
I have several Spring data repositories which have some joins to the same table, lets say, Client table. So in order to not repeat the sql script for the creation of the Client tab
Solution 1:
The normal practice is not to create a custom schema for each test, but create the full schema for all tests using the same script/mechanism that you'll use in production.
Database schema aren't modular, they have dependencies all over the place. These dependencies come in the form of foreign keys, but also as triggers or materialised views and constraints.
If your schema is small and simple there is no point in going through the hassle of breaking it into pieces. If it is large it becomes easy to miss something and have tests that don't properly represent the production environment.
Post a Comment for "Sql Scripts For Creation Of Same Table In Repository Tests"