【问题标题】:arquillian testng test do not start jboss managedarquillian testng 测试不启动 jboss 管理
【发布时间】:2017-02-02 02:49:19
【问题描述】:

我的方案是在托管的 jboss 上启动 arquillian 测试。 实际上我的耳朵已经部署在 Jboss 上,所以我没有使用 ShrinkWrap 将任何存档放在那里。 我的测试在 testng 上运行。 为了启动 Jboss,我按照 arquillian 文档的建议提供了一个自定义 maven 配置文件:

    <profile>
        <id>arquillian-jbossas-managed</id>
        <dependencies>
            <dependency>
                <groupId>org.jboss.spec</groupId>
                <artifactId>jboss-javaee-web-6.0</artifactId>
                <version>2.0.0.Final</version>
                <type>pom</type>
                <scope>provided</scope>
                <exclusions>
                    <exclusion>
                        <groupId>org.apache.xalan</groupId>
                        <artifactId>xalan</artifactId>
                    </exclusion>
                 </exclusions>
            </dependency>
            <dependency>
                <groupId>org.jboss.as</groupId>
                <artifactId>jboss-as-arquillian-container-managed</artifactId>
                <version>7.1.1.Final</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.jboss.arquillian.protocol</groupId>
                <artifactId>arquillian-protocol-servlet</artifactId>
                <scope>test</scope>
            </dependency>
        </dependencies>           
    </profile>

实际上,我的 Jboss 从未启动,我无法弄清楚发生了什么。 Maven 调试不提供任何关于他试图启动老板的事实的信息。

Arquillian 上的什么触发了服务器的启动? 我可以依靠某种钩子吗?

非常感谢

【问题讨论】:

  • 有趣的问题。所以我如何理解这个工作是你选择你的容器连接器——你已经做了 jboss-as-arquillian-container-managed。当您开始 JUnit 测试时(具有 @RunWith(Arquillian.class) Arquillian 将加载可用的连接器,在您的情况下应该是托管的连接器。我看不出您的场景是如何失败的?测试开始但没有连接拒绝?
  • 在我之前的评论中,我的意思是 TestNG 而不是 JUnit,抱歉。

标签: jboss7.x testng jboss-arquillian


【解决方案1】:

我终于发现了我的错误:

我没有在 pom 中包含这个依赖:

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

没有它,它不会抛出异常,但服务器不会启动。 其实有点棘手……

【讨论】:

    【解决方案2】:

    对于 Arquillian 触发器,服务器 TestNG-tests 类的启动也必须扩展 Arquillian。

        @Test(groups = "test")
        public class TestServiceNGTest extends Arquillian {
          @Deployment
          public static WebArchive createDeployment() {
            WebArchive war = ShrinkWrap.create(WebArchive.class).addClass(TestService.class);
    
              System.out.println(war.toString(true));
          return war;
          }
        // ... tests sources 
        }
    

    【讨论】:

      猜你喜欢
      • 2017-06-05
      • 2014-09-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-01-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多