Hi folks! Recently, I've been trying to improve my...
# server
ł
Hi folks! Recently, I've been trying to improve my integration tests strategy. I've already removed
@Transactional
from them, and I use testcontainers. And I wonder if there is some library that could be used to populate database (for integration tests - Spring, Kotlin/JVM) but not in an usual way. Using plain SQL (import.sql, which is default in Spring) is fast but when I used it, it was hard to keep the data in SQL up-to-date with all the business requirements (not all of them can be database constraints). On the other hand, using the business logic entry points to populate the data regarding all the business rules can introduce an overhead. So some kind of SQL-generator for business logic would be great. How do I imagine it could work? I'll have e.g.
PaymentInitDb
class which will call some business logic parts of the system (let's say
PaymentFacade
). It will cause changes committed to the database, so the dump can be made. If we already have the dump, we can use it as our import.sql. Do you know if something like this exists? I'll be very grateful for help, because I probably google that wrong, because I couldn't find anything like that
e
I'd go with
Exposed
to quickly load up a test database with data. In another thread (maybe feed / announcements?) combine exposed with https://kotlinlang.slack.com/archives/C0BJ0GTE2/p1668539856830919 seems like a reasonable choice