目前是否可以在Spring bean上运行Arquillian测试?

时间:2016-08-28 05:38:23

标签: spring testing integration-testing classnotfoundexception jboss-arquillian

从我使用Arquillian Spring Framework Extension运行Arquillian测试的经验来看,在我看来,目前情况严重受损。

我尝试过比arquillian展示项目中的Spring Inject示例更简单的运行测试(即没有类, applicationContext.xml ,并且只有一个测试assertTrue(true)为其身体。)

以下是我的项目依赖项

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.jboss.arquillian</groupId>
            <artifactId>arquillian-bom</artifactId>
            <version>1.1.11.Final</version>
            <scope>import</scope>
            <type>pom</type>
        </dependency>
    </dependencies>
</dependencyManagement>

<dependencies>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-web-api</artifactId>
        <version>7.0</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.apache.wicket</groupId>
        <artifactId>wicket-core</artifactId>
        <version>${wicket.version}</version>
        <exclusions>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.apache.wicket</groupId>
        <artifactId>wicket-spring</artifactId>
        <version>${wicket.version}</version>
    </dependency>

    <dependency>
        <groupId>de.agilecoders.wicket.webjars</groupId>
        <artifactId>wicket-webjars</artifactId>
        <version>0.5.5</version>
    </dependency>
    <dependency>
        <groupId>org.webjars</groupId>
        <artifactId>adminlte</artifactId>
        <version>2.3.5</version>
    </dependency>
    <dependency>
        <groupId>org.webjars</groupId>
        <artifactId>datatables</artifactId>
        <version>1.10.12</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>4.3.2.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-orm</artifactId>
        <version>4.3.2.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>4.3.2.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-jpa</artifactId>
        <version>1.10.2.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>${junit.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.arquillian.junit</groupId>
        <artifactId>arquillian-junit-container</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.wildfly.arquillian</groupId>
        <artifactId>wildfly-arquillian-container-remote</artifactId>
        <version>2.0.0.Final</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.arquillian.extension</groupId>
        <artifactId>arquillian-service-integration-spring-inject</artifactId>
        <version>1.1.0.Alpha1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.arquillian.extension</groupId>
        <artifactId>arquillian-service-deployer-spring-3</artifactId>
        <version>1.0.0.Beta3</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.shrinkwrap.resolver</groupId>
        <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.arquillian.protocol</groupId>
        <artifactId>arquillian-protocol-servlet</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

然而,这只会导致以下错误

Caused by: java.lang.ClassNotFoundException: org.springframework.beans.factory.config.EmbeddedValueResolver from [Module "deployment.e5488c33-14dd-41b6-8996-d616c11cbbb5.war:main" from Service Module Loader]

我已经尝试使用Shrinkwrap解析器来包含必要的罐子,但是这个错误仍然出现了。

那么请告诉我,Arquillian测试的Spring bean和组件目前是否已被破坏?

P.S:我使用的Spring版本是4.3.2。

0 个答案:

没有答案