RunningJSFUnit

Running JSFUnit Tests

First Prepare your WAR

If you are not using JBoss AS 5, you will need to prepare your WAR file when you build it using the Ant instructions or Maven instructions.  If you are using JBoss AS 5 then you can use the JSFUnit Microcontainer Deployer, which doesn't require any changes to the WAR.

 

Choose how you will run your tests

Since JSFUnit uses Apache Cactus to run the tests, you can use any method described on the Cactus site.  Click Here.

 

Running tests from the JSFUnit Console

If you are using a Servlet 3.0 container then you can use the Using JSFUnit with Servlet 3.0.  Just deploy your application and append /jsfunit your URL:

http://localhost:8080/myjsfapp/jsfunit

Running tests from the browser

If you are not using Servlet 3.0 then you can still run tests from the browser.  You just deploy your "JSFUnified" application and type in a URL that includes the tests suite to execute.

http://localhost:8080/myjsfapp/ServletTestRunner?suite=com.foo.JSFUnitTest&xsl=cactus-report.xsl

When you are done, the result will look something like this:

 

 

Running tests from your build

You can run JSFUnit tests with your build the same as you run any other JUnit test.  However, because JSFUnit runs inside the container you will need to start your servlet container before or during the build.  The Ant instructions and Maven instructions describe ways to accomplish this, but there are many other ways to do it as shown on the Cactus web site.