I'm making this post mainly because I was asked to help someone get JSFUnit running. I'm really much too busy at the moment to explain in detail how to do everything.

So, attached is the guess number example app with a simple JSFUnit test.


The main thing to note is the way the WAR is created using the jsf-unit-build ant task.


Once that task has been run deploy the newly created war that will be located in ${build.dir}/jsf-unit/guessNumber.war.


After that you can simply just navigate to: http://localhost:8080/guessNumber/ServletTestRunner?suite=test.GuessNumberTest&xsl=cactus-report.xsl.



Or, if you prefer to run your tests in eclipse open up the GuessNumberTest class and select run as junit. Ensuring that you have set your cactus.contextURL jvm arg as explained in this link http://community.jboss.org/wiki/UsingJSFUnitwithEclipse .

It should be something like -Dcactus.contextURL=http://localhost:8080/guessNumber



Hope this helps.



Attached is the source including the eclipse .project. It is pretty messy and you will need to make sure you fix up the class paths in the build.properties file to match your working environment.