dagblog.
← Archive

Pisces — Complex test scenarios


When I was debugging Luntclipse (an Eclipse plug-in for Luntbuild) at the start of the week, I ran into a situation most developers know. Everything worked for me, of course, but several people reported some really odd bugs.

The problem turned out to be somewhere between Java 5.0 and Hessian. Hessian is a web services protocol through which Luntbuild exposes its API for remote calls. I hadn’t run into anything during testing because I use Java 1.4.2. After that I spent a while thinking about how to avoid this sort of mistake.

Using a JUnit test was the obvious idea. The question was how to run it in different Java environments. Today I came across Project Pisces through Amir Shevat’s Taking JUnit Out of the Box.

Project Pisces is an innovative open source project that extends the JUnit framework. Like many other extensions, Pisces adds functionality to JUnit while keeping the way you use it exactly the same.
At the heart of Pisces lies the ability to run JUnit tests on a remote JVM on the same computer, or on a separate one. These remote tests are wrapped in JUnit tests that are run locally

Pisces has two parts, the agent and the test wrapper. The agent, a standalone Java program, runs in the environment we want to test. In my case I’d run one agent on Java 1.5 and another on Java 1.4.2, on the same computer or different ones. The test wrapper (the RemoteTestCase class extends TestCase) wraps the class containing your test or tests and lets you specify the name of the agent
on which to run them.

Run the resulting test wrapper or group like any JUnit test, preferably through TestSuite. The article explains it well, with pictures, and I highly recommend it. One last twist. I got invaluable feedback while debugging Luntclipse from Alex Popescu, a developer
on the TestNG testing framework (see Jablok’s Next-Generation Testing), which competes directly with JUnit.

Medium version

Related articles

Related CZ Podcast episodes