2014-04-11 60 views
1

我的場景是啓動arbillian測試在一個jboss管理。 其實我的耳朵已經部署在Jboss上,所以我沒有在ShrinkWrap中放置任何存檔。 我的測試在testng上運行。 要啓動JBoss我提供了一個定製的Maven配置文件作爲的Arquillian文檔提示:arquillian testng測試不啓動jboss管理

<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會觸發服務器的啓動嗎? 有一些我可以依賴的鉤子?

非常感謝

+0

有趣的問題。所以我怎麼理解這個工作是你選擇你的容器連接器 - 你已經做了jboss-as-arquillian-container-managed。當你開始你的JUnit測試(擁有@RunWith(Arquillian.class))時,Arquillian將加載可用的連接器,在你的情況下它應該是被管理的連接器。我沒有看到你的方案失敗了嗎?測試開始但沒有打到連接拒絕? – dbalakirev

+0

在我之前的評論中,我的意思是TestNG不是JUnit對不起。 – dbalakirev

回答

0

我終於找到了我的錯誤:

我並沒有包括在POM這種依賴關係:

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

沒有它也不例外它拋出,但服務器不會啓動。 實際上有點棘手...

0

對於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 
    }