2012-02-27 93 views

回答

1

當你作爲TestNG的套件運行你會使用TestNG的默認報告位置,這是

${your base dir}/test-output 

當您從Maven的運行,你基本上使用Maven的萬無一失插件執行TestNG的測試。默認情況下,報告輸出目錄爲surefire爲

${your build directory}/surefire-reports 

這就是爲什麼您會在兩次運行中看到差異。 爲了得到在同一文件夾中的輸出TestNG的那樣,你可以明確地指定萬無一失插件報告目錄下的配置部分

<reportsDirectory>${basedir}/test-output</reportsDirectory> 

,然後根據運行Maven的測試,看輸出那裏。

你可以參考下面的鏈接來看看如何配置你的pom的surefire插件。 http://maven.apache.org/plugins/maven-surefire-plugin/examples/testng.html

+0

不,我還沒有能夠得到TestNG的報告和Maven同時報告時,我作爲運行運行 - > Maven的測試 – SeleniumTester 2012-02-28 06:05:28

+0

我覺得你的問題是「我應該怎麼做才能讓測試輸出文件夾中創建運行 - > Maven測試?「 :)所以這就是答案。 你可以粘貼你的surefire插件配置。我懷疑你保留usedefaultlisteners屬性爲false。 – 2012-02-28 07:20:41

+0

在我的配置文件中包含 true之後,現在我能夠查看TestNG Reports以及Surefire Reports。但是現在,如果我想編輯Suite文件夾的名稱,我該怎麼辦? – SeleniumTester 2012-02-28 08:45:45

0
<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-surefire-plugin</artifactId> 
      <version>2.16</version> 
      <configuration> 
       <testFailureIgnore>true</testFailureIgnore> 
      </configuration> 
     </plugin> 
    </plugins> 
</build> 
+0

這對我有用:) – 2014-09-09 21:22:24

相關問題