Monday, August 6, 2007

Using FitLibrary with Patang

Recently I had to do a user acceptance test a.k.a. UAT, which involves testing a set of EJB3 beans running in JBoss 4.2.0.GA.

Decided to go for FitNesse & Patang combo, but to my horror Patang by default works with Fit as oppose to FitLibrary. The tests I'm running relies on special fixtures & features available only in FitLibrary.

After scouring through Patang's source code, I quickly locate the line where Patang calls Fit. Its actually inside FitServerRunner in method run. I changed the following line

   
FitServer fitServer = new FitServer();


to this:

   
FitServerBridge fitServer = new FitLibraryServer();


Then after rebuilding the Patang jars, I followed exactly the instructions as laid out in Patang's simple but effective manual. In no time, I was able to execute my UAT which utilises my deployed EJB3 beans in JBoss. Neat.

Now the hard part : coaching the QA team how to do modify a FitNesse WiKi. Sigh ....

BTW, the full source code for my modified FitServerRunner is shown below.

// START : code

package fitnesse.server;

import fit.Counts;
import fit.FitServer;
import fit.FitServerBridge;
import fitlibrary.suite.FitLibraryServer;

class FitServerRunner extends Runner {

public FitServerRunner(Parameters fitServerParameters) {
this.parameters = fitServerParameters;
}

protected Counts run(String[] params) throws Exception {
// FitServer fitServer = new FitServer();
FitServerBridge fitServer = new FitLibraryServer();

fitServer.run(params);
return fitServer.getCounts();
}

}

// END : code