Arquillian + JSFUnit + Selenium
stefanorg Mar 9, 2011 4:39 AMHi all,
i'm trying to run some example test, i've downloaded arquillian from the git repository and succesfully run the arquillian-seleniun extension test case, within eclipse with jboss-remote-6
After that i'm trying to integrate arquillian with jsf-unit and run seleniun in a different test project so i've downloaded the gettingstart project of jsfunit from:
http://anonsvn.jboss.org/repos/jsfunit/trunk/gettingstarted
i've added this dependency to the pom.xml:
<dependency> <groupId>org.jboss.arquillian</groupId> <artifactId>arquillian-spi</artifactId> <version>1.0.0-20110303.090207-297</version> <type>pom</type> <scope>compile</scope> </dependency> <dependency> <groupId>org.jboss.arquillian.extension</groupId> <artifactId>arquillian-selenium</artifactId> <version>1.0.0-SNAPSHOT</version> <type>jar</type> <scope>provided</scope> </dependency> <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium</artifactId> <version>2.0b1</version> <type>jar</type> <scope>provided</scope> </dependency> <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-server</artifactId> <version>2.0b1</version> <type>jar</type> <scope>provided</scope> </dependency> <dependency> <groupId>org.jboss.arquillian.testenricher</groupId> <artifactId>arquillian-testenricher-resource</artifactId> <version>1.0.0-20110303.090631-273</version> <type>pom</type> <scope>provided</scope> </dependency> <dependency> <groupId>org.jboss.arquillian.testenricher</groupId> <artifactId>arquillian-testenricher-ejb</artifactId> <version>1.0.0-20110303.090547-275</version> <type>pom</type> <scope>provided</scope> </dependency>
The arquillian-selenium extension is resolved from workspace in eclipse because i've not found it in a public repository, i'm new to maven so i don't know if this is a problem.
the modified arquillian.xml:
<arquillian xmlns="http://jboss.com/arquillian" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jboss="urn:arq:org.jboss.arquillian.container.jbossas.remote_6" xmlns:selenium="urn:arq:org.jboss.arquillian.selenium"> <jboss:container> <jboss:remoteServerAddress>localhost</jboss:remoteServerAddress> <jboss:remoteServerHttpPort>8080</jboss:remoteServerHttpPort> </jboss:container> <selenium:extension> <!-- a delay after each selenium command, it is overridden in system properties --> <selenium:speed>5000</selenium:speed> <selenium:serverEnable>true</selenium:serverEnable> </selenium:extension> </arquillian>
This is my HelloWorldSelenium class:
import org.jboss.arquillian.api.Deployment; import org.jboss.arquillian.api.Run; import org.jboss.arquillian.api.RunModeType; import org.jboss.arquillian.junit.Arquillian; import org.jboss.arquillian.selenium.annotation.Selenium; import org.jboss.shrinkwrap.api.ArchivePaths; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; i import com.thoughtworks.selenium.DefaultSelenium; @RunWith(Arquillian.class) @Run(RunModeType.AS_CLIENT) public class HelloWorldSelenium { @Selenium private DefaultSelenium driver; @Deployment public static WebArchive createDeployment() { WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war") .setWebXML(new File("src/main/webapp/WEB-INF/web.xml")) .addPackage(Package.getPackage("org.jboss.jsfunit.example.hellojsf")) // my test package .addResource(new File("src/main/webapp", "index.xhtml")) .addWebResource(EmptyAsset.INSTANCE, "beans.xml") .addWebResource(new File("src/main/webapp/WEB-INF/faces-config.xml"), "faces-config.xml") .addManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml")); System.out.println(war.toString(true)); // for debugging return war; } @Test public void test(){ driver.open("http://localhost:8080/test/index.faces"); } }
when i start the test i get this error:
org.jboss.arquillian.impl.event.FiredEventException: java.lang.NullPointerException
at org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:68)
at org.jboss.arquillian.impl.context.AbstractEventContext.fire(AbstractEventContext.java:115)
at org.jboss.arquillian.impl.EventTestRunnerAdaptor.beforeSuite(EventTestRunnerAdaptor.java:68)
at org.jboss.arquillian.junit.Arquillian.<init>(Arquillian.java:89)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:32)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:41)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:31)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.NullPointerException
at org.jboss.arquillian.selenium.instantiator.SeleniumServerRunner.<init>(SeleniumServerRunner.java:57)
at org.jboss.arquillian.selenium.event.SeleniumServerStartupHandler.callback(SeleniumServerStartupHandler.java:58)
at org.jboss.arquillian.selenium.event.SeleniumServerStartupHandler.callback(SeleniumServerStartupHandler.java:1)
at org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:63)
... 21 more
thanks for any help.
I'm using jboss 6.0.0 Final