【问题标题】:Arquillian Tests and Maven ProfileArquillian 测试和 Maven 配置文件
【发布时间】:2016-02-27 04:22:46
【问题描述】:

我在我的项目中使用 Arquillian 进行测试。我创建了一个包含所有 Arquillian 依赖项的 maven 配置文件:

<profile>
<id>arquillian-jbossas-managed</id>
 <dependencyManagement>
<dependencies>
    <dependency>
        <groupId>org.jboss.arquillian</groupId>
        <artifactId>arquillian-bom</artifactId>
        <version>1.1.5.Final</version>
        <scope>import</scope>
        <type>pom</type>
    </dependency>
</dependencies>
</dependencyManagement>

<dependencies>
 <dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.10</version>
</dependency>

<dependency>
    <groupId>org.jboss.arquillian.junit</groupId>
 <artifactId>arquillian-junit-container</artifactId>
 <scope>test</scope>
</dependency>
    <dependency>
        <groupId>org.jboss.spec</groupId>
        <artifactId>jboss-javaee-6.0</artifactId>
        <version>1.0.0.Final</version>
        <type>pom</type>
        <scope>provided</scope>
    </dependency>
 <dependency>
     <groupId>org.wildfly.arquillian</groupId>
     <artifactId>wildfly-arquillian-container-managed</artifactId>
    <version>1.0.0.Alpha2</version>
    <scope>test</scope>
    </dependency>

    </dependencies>
</profile>

现在,我面临的问题是,当此配置文件被停用时,构建服务器仍会尝试执行通过 Arquillian 运行的测试,当然构建会失败。那么,我怎样才能确保当 Arquillian 的配置文件被停用时,测试不会被执行。

【问题讨论】:

  • 您可以将以下内容添加到您的构建中“-Dmaven.test.skip=true”

标签: maven jboss-arquillian


【解决方案1】:

那是因为测试使用 @RunWith(arquillian.class) 进行注释,因此使用 arquillian 运行,在 pom 文件中,您可以在构建部分中指定跳过会阻止这种情况的测试:)

【讨论】:

    猜你喜欢
    • 2019-05-02
    • 2017-06-05
    • 2018-03-07
    • 1970-01-01
    • 1970-01-01
    • 2019-04-11
    • 1970-01-01
    • 2018-07-29
    • 1970-01-01
    相关资源
    最近更新 更多