Skip to main content

Timeline for Are unit tests really that useful?

Current License: CC BY-SA 3.0

13 events
when toggle format what by license comment
Jul 26, 2012 at 7:36 comment added Lie Ryan @BrendanLong: I doubt as he's maintaining a codebase with 4 MLOC, that his company is really concerned about keeping their codebase small for the sake of having less bugs. I'd venture that the SQLite managed better in creating a complex system in relatively small amount of code. Unit testing can actually make your normal code smaller because you know that if you cut out the wrong part of the code, that it will trigger an alarm as a result.
Jul 25, 2012 at 19:06 history made wiki Post Made Community Wiki by Loren Pechtel
Jul 25, 2012 at 15:53 comment added Brendan Long @MasonWheeler It's notable most people try really hard to keep their normal code small (less code -> easier to understand -> less bugs), but that's frequently a waste of time with unit tests. Not to mention that SQLite is an extremely old project that doesn't have to deal with budget constraints. Very few people would recommend testing on that level for a normal application.
Jul 25, 2012 at 6:43 comment added Varun Achar This is especially true when you're a backend developer who doesn't have the time to start making a black and white webpage just so that you can test your back end logic. All i have to do supply mock request and session objects and run my controllers through a unit test, and at the end of it all i know if it's right or wrong. If you use DI, simply inject a DAO which interacts with an in memory database so that your database doesn't change or simply throw a Exception and catch it so that your data doesn't get committed. I say YES to unit testing.
Jul 25, 2012 at 1:53 comment added Izkata @MasonWheeler You're failing at the first of Zeno's paradoxes. If you want to scale up this image to SQLite's level of testing, the X-axis will have to also expand something like 100 times its current length.
Jul 25, 2012 at 0:24 comment added Aatch @MasonWheeler That's a very nice horse you're beating, I think it may have died though... SQLite has that many tests because its a goddamn database. I want to make sure that works. As another example, the Silverstripe framework has close to a 1:1 ratio of tests:code, so it's not like SQLite is representative.
Jul 24, 2012 at 23:11 comment added Heath Lilley When dealing with legacy code I would agree 100%, but when writing green field using a testing framework that I am familiar with I can put together a test in a reasonable amount of time. Code coverage is a byproduct of good unit tests, the truest way to measure the quality of your test code is to have code reviews.
Jul 24, 2012 at 22:55 comment added Mason Wheeler Cute graphic, but it's got the scale badly wrong. As I pointed out in my answer, SQLite's full test coverage requires approximately 1200x more code in tests than actual code in the product itself. And even if you're not that obsessive about full coverage, you still need several times more tests than product to even approach any useful level of coverage in your tests. To be accurate here, the vertical part of that red line would have to keep going up and up and up for about 3 page lengths.
Jul 24, 2012 at 21:56 history edited gnat CC BY-SA 3.0
edited body
Jul 24, 2012 at 21:55 history edited Heath Lilley CC BY-SA 3.0
Added url for image creator
Jul 24, 2012 at 21:44 comment added Heath Lilley Yes, you can. Isolate the web layer in your unit tests to test web configuration (URLS, input validation, etc). By stubbing the web and database layers you can test the business tier without a database or web server. I use dbunit to test my DB. If you want you can still do full integration testing, but I do that as a specific task after development.
Jul 24, 2012 at 21:36 comment added Jane Doe "Also imagine the overhead of building the code, starting your local web server, browsing to the page in question, entering the data or setting the input to the proper test seed, submitting the form, and analyzing the results..." this is EXACTLY the way it is now.. and it's starting to annoy me tremendously lol. so you're saying i could actually "solve" that with nUnit/unit tests?
Jul 24, 2012 at 21:13 history answered Heath Lilley CC BY-SA 3.0