Maven and JSFUnit
sebastian.weisser Jun 9, 2008 9:36 AMHello,
i really have a hard time to configure JSFUnit and Maven. My problem is, that surefire is not testing anything. It always finishes with the message "No tests to run" but there is a basic test.
If I'm using the browser to test the classes it works.
Perhaps somebody could point me in the right direction.
My web.xml in the testing war looks like this:
<web-app version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <display-name>sbvr2</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.faces</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.faces</url-pattern> </servlet-mapping> − <context-param> <param-name>com.sun.faces.displayConfiguration</param-name> <param-value>true</param-value> </context-param> <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.apache.cactus.server.ServletTestRedirector</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> </web-app>
The interesting parts from pom.xml are just copied from the wiki page and customized. They look like this:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <configuration> <!-- Default value for dependentWarIncludes is ** --> <dependentWarIncludes>**</dependentWarIncludes> <!-- Directive dependentWarExcludes possess no default value --> <dependentWarExcludes>WEB-INF/web.xml,index.jsp</dependentWarExcludes> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <executions> <execution> <id>surefire-it</id> <phase>integration-test</phase> <goals> <goal>test</goal> </goals> <configuration> <skip>false</skip> <systemProperties> <property> <name>cactus.contextURL</name> <value>http://localhost:8080/sbvr-jsfunit</value> </property> </systemProperties> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> <configuration> <container> <containerId>jboss4x</containerId> <home>l:/jboss_4.2.2</home> <!-- Container's type. Valid values are installed, embedded and remote. Default value is installed. --> <type>installed</type> </container> <configuration> <!-- A list of deployables that are going to be deployed in the container when it is started --> <deployables> <deployable> <location>${project.build.directory}/${build.finalName}.war</location> <type>war</type> <pingURL>http://localhost:8080/</pingURL> </deployable> </deployables> <!-- For standalone configuration this is the location where Cargo will create the configuration and for existing configuration this is where it is located --> <home>L:/jboss_4.2.2/server/default/</home> <!-- Values to use for various Configuration properties --> <properties> <cargo.jboss.configuration>default</cargo.jboss.configuration> <!-- This is set to 1299 by default but JBoss default configuration uses 1099 --> <cargo.rmi.port>1099</cargo.rmi.port> </properties> <!-- Configuration's type. Valid values are standalone, existing and runtime. Defaults to standalone --> <type>existing</type> </configuration> <timeout>25000</timeout> <!-- Decides if Cargo should wait after the container is started or not. Default value is true. --> <wait>false</wait> </configuration> <executions> <execution> <id>start-container</id> <phase>pre-integration-test</phase> <goals> <goal>start</goal> </goals> </execution> <execution> <id>stop-container</id> <phase>post-integration-test</phase> <goals> <goal>stop</goal> </goals> </execution> </executions> </plugin>
The test war is called sbvr-jsfunit.war and is deployed in the context /sbvr-jsfunit. I'm trying to get it running via the command mvn integration-test.
When I invoke the testing manually via the url
http://localhost:8080/sbvr-jsfunit/ServletTestRunner?suite=de.booyaa.sbvr.jsf.communities.test.CommunityBeanTest&xsl=cactus-report.xslthe test is run with the same war file.
Perhaps somebody knows what's wrong because my knowledge of maven is limited.