Skip to main content
9 events
when toggle format what by license comment
Mar 27, 2020 at 6:37 comment added Bart van Ingen Schenau @elfico: Sharing a database between tests can create a coupling, where for example test 5 will start failing if tests 2 and 4 are not executed before it in that order. That limits your ability to run a subset of the tests.
Mar 26, 2020 at 13:21 comment added Doc Brown @elfico: this can work well, but be careful: when reusing the same db for several tests (in-memory or not), one has to make sure not to get unwanted side effects. It can also prevent parallelization of tests. It depends all on your specific requirements.
Mar 26, 2020 at 13:06 vote accept elfico
Mar 26, 2020 at 13:06 vote accept elfico
Mar 26, 2020 at 13:06
Mar 26, 2020 at 13:06 comment added elfico thanks a lot for the detailed answer. I can honestly answer yes to point 1 and 3. For point, it is worth noting that the setup for the in-memory database occurs once as this is a shared context so the same setup is used across all tests. I wrote two tests using the same in-memory database and though the first took about 1.5s, the second took 74ms. The second test for using the mocking method took about 20ms compared to about 350ms for the first. These numbers are average of course. Thanks for the link too
Mar 26, 2020 at 13:04 history edited Doc Brown CC BY-SA 4.0
deleted 17 characters in body
Mar 26, 2020 at 12:06 history edited Doc Brown CC BY-SA 4.0
added 81 characters in body
Mar 26, 2020 at 12:00 history edited Doc Brown CC BY-SA 4.0
added 81 characters in body
Mar 26, 2020 at 11:54 history answered Doc Brown CC BY-SA 4.0