[jsfunit-dev] embedded tomcat 7 with JSFUnit

Paul Rivera paul_mrivera at yahoo.com
Sun Jun 24 02:55:22 EDT 2012


Hi Guys,
I'm using Arquillian to test my JSF beans in an embedded Tomcat 7.0.27 container. Problem is, I'm getting this exception when I run maven test: see http://pastebin.com/Ewiwe2CQ
I have the following pom.xml: see http://pastebin.com/u2UuakAc
Here's my Unit Test Class:
@RunWith(Arquillian.class)
publicclassUserBeanTest{

@Deployment
publicstaticWebArchivecreateDeployment(){
    MavenDependencyResolverresolver =DependencyResolvers.use(MavenDependencyResolver.class).loadMetadataFromPom("pom.xml");

    WebArchivewar =ShrinkWrap.create(WebArchive.class)
        .setWebXML(newFile("src/main/webapp/WEB-INF/web.xml"))
        .addAsWebResource(newFile("src/main/webapp/WEB-INF/faces-config.xml"),"/WEB-INF/faces-config.xml")
        .addClass(UserBean.class);
    war.addAsWebResource(newFile("src/main/webapp","user.xhtml"));

    //add these libraries only for non JEE containers (e.g. tomcat)
    war.addAsLibraries(resolver.artifact("org.apache.myfaces.core:myfaces-api:2.1.5").resolveAsFiles());
    war.addAsLibraries(resolver.artifact("org.apache.myfaces.core:myfaces-impl:2.1.5").resolveAsFiles());
    returnwar;
}

@Test
@InitialPage("/user.jsf")
publicvoidshould_create_greeting(JSFServerSessionserver,JSFClientSessionclient){
    //some tests here
}

}
The problem seems to occur during deployment of the WebArchive when the Arquillian tests run, and not when my @Test methods run. I was able to make things work by using managed tomcat. But I'd prefer an embedded tomcat though. Has anyone had better luck with this?
Best Regards,
Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jsfunit-dev/attachments/20120623/6da4721f/attachment-0001.html 


More information about the jsfunit-dev mailing list