Arquillian for Blackbox Selenium testing

191 views Asked by At

I am trying to use Arquillian / Graphene for my selenium blackbox testing. I would like to use arquillian along with testng.

I do not use any jboss/tomcat. I would like to run my tests as standalone tests as we do in testng.

My test is very simple.

import org.jboss.arquillian.testng.Arquillian;
import org.testng.annotations.Test;

public class Test2 extends Arquillian{
  @Test(description = "Login")
  public void f1() {
      System.out.println("T2 - F1 : *********************testing******************");
  }
}

But i get this exception. I do not have any clue on this. Please help.

            java.lang.RuntimeException: Could not create new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor
                at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:165)
                at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:102)
                at org.jboss.arquillian.test.spi.TestRunnerAdaptorBuilder.build(TestRunnerAdaptorBuilder.java:52)
                at org.jboss.arquillian.testng.Arquillian.arquillianBeforeSuite(Arquillian.java:70)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                at java.lang.reflect.Method.invoke(Unknown Source)
                at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
                at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
                at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
                at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
                at org.testng.SuiteRunner.privateRun(SuiteRunner.java:277)
                at org.testng.SuiteRunner.run(SuiteRunner.java:240)
                at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
                at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
                at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
                at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
                at org.testng.TestNG.run(TestNG.java:1057)
                at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
                at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
                at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
            Caused by: java.lang.reflect.InvocationTargetException
                at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
                at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
                at java.lang.reflect.Constructor.newInstance(Unknown Source)
                at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:161)
                ... 21 more
            Caused by: java.lang.RuntimeException: Could not create new instance of class org.jboss.arquillian.core.impl.ManagerImpl
                at org.jboss.arquillian.core.spi.SecurityActions.newInstance(SecurityActions.java:165)
                at org.jboss.arquillian.core.spi.SecurityActions.newInstance(SecurityActions.java:102)
                at org.jboss.arquillian.core.spi.ManagerBuilder.create(ManagerBuilder.java:77)
                at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.<init>(EventTestRunnerAdaptor.java:62)
                ... 26 more
            Caused by: java.lang.reflect.InvocationTargetException
                at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
                at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
                at java.lang.reflect.Constructor.newInstance(Unknown Source)
                at org.jboss.arquillian.core.spi.SecurityActions.newInstance(SecurityActions.java:161)
                ... 29 more
            Caused by: java.lang.NoClassDefFoundError: org/jboss/arquillian/container/test/spi/client/deployment/AuxiliaryArchiveAppender
                at org.jboss.arquillian.testng.container.TestNGContainerExtension.register(TestNGContainerExtension.java:34)
                at org.jboss.arquillian.core.impl.loadable.LoadableExtensionLoader.load(LoadableExtensionLoader.java:79)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                at java.lang.reflect.Method.invoke(Unknown Source)
                at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
                at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
                at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
                at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145)
                at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116)
                at org.jboss.arquillian.core.impl.ManagerImpl.fireProcessing(ManagerImpl.java:346)
                at org.jboss.arquillian.core.impl.ManagerImpl.<init>(ManagerImpl.java:100)
                ... 34 more
            Caused by: java.lang.ClassNotFoundException: org.jboss.arquillian.container.test.spi.client.deployment.AuxiliaryArchiveAppender
                at java.net.URLClassLoader.findClass(Unknown Source)
                at java.lang.ClassLoader.loadClass(Unknown Source)
                at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
                at java.lang.ClassLoader.loadClass(Unknown Source)
                ... 47 more
2

There are 2 answers

0
vins On BEST ANSWER

Do you use Maven? If yes, ensure if you have below dependencies.

<version.org.jboss.arquillian>1.1.11.Final</version.org.jboss.arquillian>
<version.org.jboss.arquillian.drone>2.0.0.Beta1</version.org.jboss.arquillian.drone>
<version.org.jboss.arquillian.graphene>2.1.0.Alpha3</version.org.jboss.arquillian.graphene>  

<dependencies>
<dependency>
    <groupId>org.jboss.arquillian.graphene</groupId>
    <artifactId>graphene-webdriver</artifactId>
    <version>${version.org.jboss.arquillian.graphene}</version>
    <type>pom</type>
    <scope>test</scope>
</dependency>

<dependency>
     <groupId>org.testng</groupId>
     <artifactId>testng</artifactId>
     <version>6.8</version>
     <scope>test</scope>
</dependency>

<dependency>
        <groupId>org.jboss.arquillian.testng</groupId>
        <artifactId>arquillian-testng-standalone</artifactId>
        <scope>test</scope>
</dependency> 
</dependencies>

<dependencyManagement>
<dependencies>
    <!-- Arquillian Core dependencies -->
    <dependency>
        <groupId>org.jboss.arquillian</groupId>
        <artifactId>arquillian-bom</artifactId>
        <version>${version.org.jboss.arquillian}</version>
        <type>pom</type>
        <scope>import</scope>
    </dependency>
    <!-- Arquillian Drone dependencies and WebDriver/Selenium dependencies -->
    <dependency>
        <groupId>org.jboss.arquillian.extension</groupId>
        <artifactId>arquillian-drone-bom</artifactId>
        <version>${version.org.jboss.arquillian.drone}</version>
        <type>pom</type>
        <scope>import</scope>
    </dependency>
</dependencies>

0
juherr On

java.lang.ClassNotFoundException: org.jboss.arquillian.container.test.spi.client.deployment.AuxiliaryArchiveAppender

It looks like arquillian-container-test-spi.jar is not present in your classpath. Just add it.