April 2007

Creating a Swing Test Runner for Maven 2

I have been a devoted Emacs user since a co-worker introduced it to me in 2001. Emacs’ efficient layout of keystrokes enables me to work faster and longer with less hand fatigue than other editors. My optimal Java development environment is a bash shell (Cygwin if using Windows), Emacs, and a good build tool such as Maven. I feel a sense of commitment to this setup since I have been using it for over 6 years now.

Recently I have been switching projects from Maven 1 to Maven 2. This has been great except for the fact that Maven 2 does not have a GUI test runner for unit tests. Suddenly my optimal development environment is missing a test runner. In Maven 1, the test:ui goal would invoke the org.juint.swing.SwingRunner. There is an open issue for this in the Surefire JIRA to add back the GUI support to the command line, but it doesn’t look like it will be addressed any time soon.

So what to do?

One solution is to bite the bullet and join the rest of the world and use an IDE like Eclipse. This is definitely the path of least resistance. I have tried this, but it just hasn’t worked for me. I simply don’t flow as well with Eclipse.

I am thinking that the best solution is to create a Swing test runner for Maven 2. I have been looking at what this will take and have identified some components of a design. Here goes:

  • I would focus solely on TestNG for now.
  • It would be nice if the test runner did not need to be restarted after each compilation. I could see myself keeping the test runner window open, and issuing mvn compile commands in a separate window.
  • The test runner would need to fork the execution of the tests - running them in a completely separate class loader. This in itself would not be difficult. The test runner would just instantiate Surefire in the same way that the Maven Surefire plug-in does.
  • Surefire would need to know about the classpath. This could be done differently depending if the test runner were invoked from maven or from the command line.
  • The real challenge would involve reporting test events from the tests running in the surefire class loader back to the Swing application. The Eclipse plug-in for TestNG uses the RemoteTestNG class and a set of socket communications back to the GUI. I expect something similar would need to be done.

I expect to have some progress on this over the next couple of weeks, as spare time permits.

Aaron Benjamin Tomasini - More Pictures

I have uploaded a a few more photos.

Aaron Benjamin Tomasini - Born April 12, 2007

Our family grew by one today. Aaron Benajmin Tomasini was born April 12, 2007 at 3:51 PM. He was 7 lbs., 5 oz., 20 3/4″. It is amazing to me to see the miracle of new life, and to think of the great potential that is wrapped up in this wonderful package.

Grandma arrived yesterday to help out, which ended up being very fortunate since we were expecting Aaron to be delivered next week.

Aaron’s big brother William (almost 2) is getting used to the idea of having a little brother. Coming to the hospital to see mom and his new baby brother was a bit much at first. Luckily, the hospital has a McDonald’s inside. Eating a happy meal with daddy really made a difference.

I have uploaded a couple of photos. I should be adding more to the set over the next few days.