Monday, August 31, 2009

DDTUnit and Eclipse Snippets

One of the tedious aspects of using the excellent DDTUnit library is the creation of the Java class for the test case and the XML data sets. There is no nice Eclipse wizard to do that for you, but today I started to create a set of Eclipse snippets for it. My productivity went to the ditch for the first three hours, but it should pay off sometime between today and tomorrow.

I just select some complicated block of DDTUnit source code or XML on Eclipse, right-click it and choose "Add to snippets". I then replace some hard-coded values, such as the name of an input object, with a variable and save it.

Later, when I need a similar snippet, I just position the cursor where I need the new source code or XML, double-click the snippet from the toolbar, fill out any variables associated with the template (usually one or two) and goodbye round-trips to the DDTUnit reference guide.


The snippets library master:

Code comments are for newbies

I am sure you have seen or participated in a debate about how much or how little comments one should put in his own code.

Now look at this pearl I found while writing a presentation about the excellent JMock library.

Just think of the possibilities in terms of team communication: “Jim, can you unlock”