Skip to main content
6 events
when toggle format what by license comment
Nov 14, 2018 at 6:59 comment added el.pescado - нет войне @David I think it depends on how do you approach database. Is it implementation detail or vital part of system? (I lean towards the latter). If you treat database as a dumb storage of data, then yes, you might do without integration tests. However, if there's any logic in database - constraints, triggers, foreign keys, transactions, or your data layer uses custom SQL instead of plain ORM methods, I feel unit tests alone won't be enough.
Nov 13, 2018 at 21:26 comment added David @el.pescado I have to disagree. If your database communication is behind a layer of abstraction, it is really easy to mock. You can just decide which object to return. Also, the fact that something is standard doesn't make it a good thing.
Nov 13, 2018 at 8:24 comment added el.pescado - нет войне @David Do you have a database available in your ci/cd line? Sure, that's pretty standard feature. BTW, I'm not advocating integration tests instead of unit tests - I'm advocating integration tests in conjunction with unit tests. Fast unit tests are essential, but databases are too complex to rely on unit tests with mocked interactions.
Nov 12, 2018 at 8:46 comment added David Database integration tests are bad though. Do you have a database available in your ci/cd line? That seems pretty complex to me. It is much easier to mock the database stuff and build a layer of abstraction to use that. Not only is that a much more elegant solution, it is as fast as can be. Unit tests need to be fast. Testing your database slows down your unittests significantly to a level that it not acceptable. Unittests shouldn't take > 10 minutes to be done, even when you have thousands of them.
Nov 4, 2015 at 14:37 comment added Daniel Hollinrake I was thinking of adding a reply similar to yours but you've said it better! In my experience having some tests on the layer that gets and stores data has saved me a lot of grief.
Nov 2, 2015 at 22:14 history answered el.pescado - нет войне CC BY-SA 3.0