2012-08-06 2 views
1

maven surefire 플러그인으로 TestNG에 대한 맞춤 리포터를 사용하려고합니다. 나는 이미 커스텀 청취자를 가지고 있으며, 그것은 받아 들여질 것 같다. 그러나 사용자 지정 기자가 전혀 사용되지 않는 것처럼 보입니다.maven surefire 플러그인과 함께 맞춤 리포터 사용

<plugin> 
    <artifactId>maven-surefire-plugin</artifactId> 
    <configuration> 
     <testFailureIgnore>false</testFailureIgnore> 
     <properties> 
      <property> 
       <name>listener</name> 
       <value>com.mystuff.test.TestNGListener</value> 
      </property> 
      <property> 
       <name>reporter</name> 
       <value>com.mystuff.test.MyEmailableReporter</value> 
      </property> 
     </properties> 
    </configuration> 
</plugin> 

이 현상이 발생하는 이유는 무엇입니까?

답변

4

나는 이것을 알아 냈다. 다음과 같이 작동하지 않는 것으로 보입니다.

<property> 
    <name>reporter</name> 
    <value>com.mystuff.test.MyEmailableReporter</value> 
</property> 

TestNG 클래스에는 TestNG#addListener(IReporter listener)이라는 메서드가 있는데, 그 이름과 반대로 IReporter을 구현하는 보고서를 허용합니다. Maven Surefire (v2.12.1)는이 메소드를 호출하여 리스너와 리포트를 추가합니다. 그러나 이름이 reporter 인 속성에서 보고서를 찾지 않습니다. 대신 listener 속성에 사용자 정의 기자를 추가해야합니다 :

<plugin> 
    <artifactId>maven-surefire-plugin</artifactId> 
    <configuration> 
     <testFailureIgnore>false</testFailureIgnore> 
     <properties> 
      <property> 
       <name>listener</name> 
       <value>com.mystuff.test.TestNGListener,com.mystuff.test.MyEmailableReporter</value> 
      </property> 
     </properties> 
    </configuration> 
</plugin> 

하지 매우 직관적.

관련 문제