Categories
Random observations

Unit testing

Okay, I have something to confess: my record on using testing frameworks to debug software is not good. In fact, my record might show that pretty much all the testing I’ve done in the past has been conducted on an ad hoc basis, using a combination of debugger and strategically placed “print” statements. The only time I can remember having used a proper testing framework with repeatable tests was at Sun Labs as an intern, and that was because it was already set up for me. Perhaps it is common for a researcher to have shoddy testing procedures in place – I don’t know. All I know is that mine have been bad.

JUnit in EclipseFor the first time, I’m using the JUnit framework to conduct repeatable tests, and I’m doing this from within the Eclipse IDE. On the first day of use, it’s already paid dividends, quickly honing in on problems in my code. Running JUnit in combo with the debugger has proved especially useful. The only reason I decided to look into testing frameworks was because I’ll probably be handing this code over to someone else to work on soon, and that provided an incentive to be a bit professional about the way I’m doing my coding work. I should mention that it took absolutely no time at all to set up my environment, though it can take a little bit of time to get each unit test just right.

Of course, none of this will come as any surprise to many of the readers of this weblog (i.e., that researchers might have questionable software engineering practices and that repeatable tests are good).

By ricky

Husband, dad, R&D manager and resident Lean Startup evangelist. I work at NICTA.

Leave a Reply

Your email address will not be published. Required fields are marked *