0

我正在尝试使用 Arquillian / Graphene 进行硒黑盒测试。我想将 arquillian 与 testng 一起使用。

我不使用任何 jboss/tomcat。我想像在 testng 中那样将我的测试作为独立测试运行。

我的测试非常简单。

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******************");
  }
}

但我得到了这个例外。我对此一无所知。请帮忙。

            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
4

2 回答 2

1

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

看起来arquillian-container-test-spi.jar您的类路径中不存在。只需添加它。

于 2016-02-12T13:24:54.733 回答
1

你使用 Maven 吗?如果是,请确保您是否具有以下依赖项。

<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>

于 2016-02-19T20:17:22.623 回答