JSFUnit 1.2 takes advantage of new features in Servlet 3.0 to make setting up and running JSFUnit tests faster and easier. To take advantage of these features:
- Use a Servlet 3.0 container
- Use the Servlet 2.5 or Servlet 3.0 deployment descriptor in your web.xml.
- Do not set metadata-complete=true
JSFUnit Console
With Servlet 3.0, JSFUnit provides a simple console that allows you to execute your tests from a browser. JSFUnit automatically detects all JSFUnit tests and presents them in the console. To bring up the console, just deploy your webapp and append /jsfunit to the base url:
http://localhost:8080/mywebapp/jsfunit/index.jsfunit
Servlets and Filters Added Automatically
If you are running in a Servlet 3.0 container you no longer need to modify your web.xml. The following declarations will be added to your WAR automatically when it is deployed:
<filter> <filter-name>JSFUnitFilter</filter-name> <filter-class>org.jboss.jsfunit.framework.JSFUnitFilter</filter-class> </filter> <filter-mapping> <filter-name>JSFUnitFilter</filter-name> <servlet-name>ServletTestRunner</servlet-name> </filter-mapping> <filter-mapping> <filter-name>JSFUnitFilter</filter-name> <servlet-name>ServletRedirector</servlet-name> </filter-mapping> <servlet> <servlet-name>ServletRedirector</servlet-name> <servlet-class>org.jboss.jsfunit.framework.JSFUnitServletRedirector</servlet-class> </servlet> <servlet> <servlet-name>ServletTestRunner</servlet-name> <servlet-class>org.apache.cactus.server.runner.ServletTestRunner</servlet-class> </servlet> <servlet-mapping> <servlet-name>ServletRedirector</servlet-name> <url-pattern>/ServletRedirector</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>ServletTestRunner</servlet-name> <url-pattern>/ServletTestRunner</url-pattern> </servlet-mapping>
Comments