by Lvl999Noob · 1y ago · 0 comments
I wonder if there's a database that works sorta like git, giving one "commit" point at the start of every test and then "branching off" so each test can do its own thing, make transactions, commit them, whatever, and finally be able to roll the whole thing back.
If that can be done then each unit test can use a full database clone with actual valid data and not just test data that was fast enough to set up before the test ran.
https://www.postgresql.org/docs/current/manage-ag-templatedb...
Creating a db from a template is not free, but if there's not too much stuff in the db it's not horrendous either. And if you're using sqlite, you might be able to backup an on-disk template to an in-memory test db.
Unless you use Clojure though it's probably not a real option.