Skip to main content
9 events
when toggle format what by license comment
Nov 3, 2015 at 14:22 comment added D Stanley @BЈовић I was not thinking of automated unit tests but manual unit tests-testing the query directly against the database outside of the actual application.Unit tests don't have to be automated.
Nov 3, 2015 at 14:21 comment added Matthieu M. @BЈовић: Unfortunately, that might not always be possible, since unfortunately there are no two compatible DBs out there and not all of them work in memory. There are also licensing issues for commercial DBs (you might not have the license to run it on any machine), ...
Nov 3, 2015 at 13:03 comment added BЈовић Good answer, but I would add that the DB should be in memory, to make sure that unit tests are fast.
Nov 3, 2015 at 9:26 comment added Selenog Another method to unit test is to have a separate DB for this, this will need to be setup such a way that each account sees his own version (schema) of the DB. Then it is a question of having a setup that will load some test data (from for example an xml-file) into the database before the unit-test runs and reverts the changes after every unit-test.
Nov 2, 2015 at 22:02 comment added mindplay.dk Yes - the example I used, as pointed out, is trivial; a real repository could have all manner of complex search and sorting options, e.g. using a query builder, etc.
Nov 2, 2015 at 21:45 comment added D Stanley Possibly - but you could also be testing that your filters, complex joins, etc. work. The example query is probably not the best candidate for "unit tests" but one with complex joins and/or aggregations might.
Nov 2, 2015 at 20:04 comment added Tulains Córdova Wouldn't you be testing whether or not the database contains certain data?
Nov 2, 2015 at 17:09 history edited D Stanley CC BY-SA 3.0
added 471 characters in body
Nov 2, 2015 at 17:03 history answered D Stanley CC BY-SA 3.0