2

maven 기반 프로젝트에서 작업 중입니다. 프로젝트에 여러 개의 모듈이 있습니다. 다음은 프로젝트 구조를이다다중 모듈 프로젝트에서 Maven failsafe 플러그인

- 프로젝트

부모 모듈 패키징 타입이 "치어"모든 모듈이 정의되어있다
--Module1 
    -- pom.xml 
--Module2 
    -- pom.xml  
--Module3-war 
    -- pom.xml 
--parent module 
    --pom.xml 

.

<build> 
      <plugins> 
       <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-failsafe-plugin</artifactId> 
       <executions> 
        <execution> 
        <id>integration-test</id> 
        <phase>integration-test</phase> 
        <goals> 
         <goal>integration-test</goal> 
        </goals> 
        </execution> 
        <execution> 
        <id>verify</id> 
        <phase>verify</phase> 
        <goals> 
         <goal>verify</goal> 
        </goals> 
        </execution> 
       </executions> 
      </plugin> 
     </plugins> 
     </build> 

아래와 같이
는 내가 명령을 "MVN 검증"실행하고, 안전 장치 플러그인 실행하기되지 않습니다 때 부모 모듈 치어의 안전 장치 - pligin을 추가했다. My Integration 테스트 이름 "TestServiceIT.java"가 구조의 module1에 있습니다.

전쟁 모듈에서 동일한 "failsafe"플러그인을 추가하면 WAR를 만든 후 failsafe 플러그인이 실행되지만 테스트 클래스를 찾을 수 없다는 것을 알게되었습니다. 그래서, 내 질문

  1. 안전 장치 플러그인이 주요의 pom.xml에 정의 될 때 다음이 왜 실행하기 아니에요 있습니다

    [INFO] Started Jetty Server 
    [INFO] 
    [INFO] --- maven-failsafe-plugin:2.15:integration-test (integration-test) @ service-integration-test 
    --- 
    [INFO] No tests to run. 
    [WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform d 
    endent! 
    [INFO] 
    [INFO] --- jetty-maven-plugin:8.1.11.v20130520:stop (stop-jetty) @ service-integration-test --- 
    [INFO] 
    [INFO] --- maven-failsafe-plugin:2.15:verify (verify) @ service-integration-test --- 
    [INFO] No tests to run. 
    

    아래를 참조하십시오?

  2. 왜 다른 모듈에 정의 된 테스트 사례를 찾을 수 없습니까?
  3. 멀티 모듈 메이븐 프로젝트에서 통합 테스트를 작성하는 가장 좋은 방법은 무엇입니까?
+0

당신이 이것에 대한 해결책을 발견 함이 버그를 테스트 할 수 없습니다? – FranAguiar

+0

다중 모듈 프로젝트에서 어떻게 든 failsafe 플러그인이 작동하지 않습니다. Failsafe Plugin은 해당 프로젝트 및 하위 모듈에서 항상 테스트를 찾습니다. – Jha

+1

내 솔루션은 새로운 모듈 "integration-test"를 만들고이 모듈에 모든 테스트를 추가하는 것이 었습니다. 이 모듈을 상위 pom에 추가하여 결국 통합 테스트를 실행하고 유효성을 검사합니다. org.apache.maven.plugins 받는다는 - 안전 장치 - 플러그인 2.19.1 <구성> .IT */*. 자바 Jha

답변

0

failsafeToScan을 failsafe 플러그인 구성에 추가해야한다고 생각합니다. 예 :

<dependencies> 
    <dependency> 
    <groupId>org.arquillian.tck.container</groupId> 
    <artifactId>arquillian-tck-container</artifactId> 
    <version>1.0.0.Final-SNAPSHOT</version> 
    <classifier>tests</classifier> 
    </dependency> 
    </dependencies> 
<build> 
    <plugins> 
    <plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-surefire-plugin</artifactId> 
    <version>2.14-SNAPSHOT</version> 
    <configuration> 
    <dependenciesToScan> 
     <dependency>org.arquillian.tck.container:arquillian-tck-container</dependency> 
    </dependenciesToScan> 
    </configuration> 
    </plugin> 
    </plugins> 
</build> 

하지만 때문에 https://jira.codehaus.org/browse/SUREFIRE-1024

관련 문제