Skip to main content
10 events
when toggle format what by license comment
Jul 20, 2014 at 23:15 history wiki removed ChrisF
Feb 6, 2013 at 22:18 comment added Apprentice Queue @Telastyn perhaps I'm misunderstanding but eventually some class needs to get down and dirty and write the SQL or write the file or send the data or interface with the GPU. Most abstractions have unavoidable leaks at some level; they are simply pragmatic and not necessarily horrible.
Feb 4, 2013 at 22:37 comment added user2348 Writing the right object is easy. Discovering some subtle difference between what you've told your ORM's validation layer and the database constraints: that's Interesting. :)
Feb 4, 2013 at 22:13 comment added Telastyn @fennec - It's slightly more complex than dead simple to stub out the interface to make sure your writes are writing the right object. It only gets hard when your classes are trying to send SQL directly down your interface (read: you have a horrible design).
Feb 4, 2013 at 21:51 comment added Anthony Pegram (...) You then create separate, integration-style tests for your database helpers (I prefer repositories) to know that those are doing the right thing, and those tests do indeed involve the database.
Feb 4, 2013 at 21:50 comment added Anthony Pegram @fennec, you're typically not hardcoding values as in strings, integers, etc., as the sole return object. You're mocking or stubbing the database classes away, but you're still returning objects describing the database--entities or models or whatever term you would want to use. Presumably, as your database changes, so do your models, and those same models are used in your tests. Your tests of your business logic should be concerned that the appropriate decisions are made regarding data that is received, or data that is to be written. (continued...)
Feb 4, 2013 at 19:59 comment added user2348 All well and good until you're unit-testing the code that manipulates the database. :P which, for a lot of people, is a lot of their code.
Feb 4, 2013 at 19:43 comment added Telastyn @fennec - unit tests aren't there to test the database, they're there to test the code that depends on database values to function.
Feb 4, 2013 at 19:39 comment added user2348 Hard-coding database return values from a little stub of a mock object is a good way to insulate the test from anything in the database which could change and break the code (e.g. column renames). It's appropriate under certain circumstances, but an easy-to-use temporary testing database is important to keep around unless you want things to break someday when you change it. If your code breaks when you swap out the database, that's a fault of the code that the test should be catching (and if you want to avoid that, you'll want to run the test suite under multiple databases.)
Feb 4, 2013 at 18:33 history answered Telastyn CC BY-SA 3.0