Re:Idea to product in 4 months : End-to-end product and tech...
by plasma on Tuesday January 10, 2012 @06:56PM
(#3449738)
Appreciate it, thanks. I definitely have tests that run instantly because they just use a mocked database, and ideally all of my tests would do that because I agree having them run instantly is so much better than waiting around.
I'm going to be more attentive to how long tests take from now on, and try and avoid a backed DB when possible. Thanks!
One of my current asp.net mvc projects has about 192 unit tests and has a total run-time around 2.3 seconds. Most of the time, the code I'm changing and working on doesn't interact with the database and so I can keep running all my unit-tests after every change to make sure I haven't broken anything. I wouldn't be running my unit-tests as regularly as I do now if I knew I'd have to wait 20 seconds each time.
Give trying using a mock for the test that involve SQLite when you find some free time. You may find the time saved to be worth it. I'd also suggest looking into dan_b's suggestion below; a one-line code change to go from in-memory to integration tests sounds interesting and if it works like I imagine it does, I think I'll be giving nHibernate another chance since my last disappointing attempt at using it.