2014-09-03 41 views
0

我使用詹金斯運行一些TestNG的測試中,當構建完成後我會在年底出現以下消息:如何設置TestNG的+詹金斯

[INFO] Build failures were ignored. 
TestNG Reports Processing: START 
Looking for TestNG results report in workspace using pattern: **/test-output/testng-result.xml 
Did not find any matching files. 
Finished: SUCCESS 

我在詹金斯看着工作區和沒有名爲test-output的文件夾,這裏的問題是,我如何告訴jenkins在那裏創建結果文件夾?

這裏是我的pom.xml如果需要的話:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 

    <groupId>com.barco.automation</groupId> 
    <artifactId>barcoAutomation</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <packaging>jar</packaging> 

    <name>barcoAutomation</name> 
    <url>http://maven.apache.org</url> 

    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <maven.compiler.source>1.7</maven.compiler.source> 
     <maven.compiler.target>1.7</maven.compiler.target> 
     <!-- added --> 
    </properties> 

    <dependencies> 
     <dependency> 
      <groupId>log4j</groupId> 
      <artifactId>log4j</artifactId> 
      <version>1.2.17</version> 
     </dependency> 
     <dependency> 
      <groupId>org.testng</groupId> 
      <artifactId>testng</artifactId> 
      <version>6.8</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.uncommons</groupId> 
      <artifactId>reportng</artifactId> 
      <version>1.1.2</version> 
     </dependency> 
     <dependency> 
      <groupId>org.seleniumhq.selenium</groupId> 
      <artifactId>selenium-java</artifactId> 
      <version>2.42.2</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.poi</groupId> 
      <artifactId>poi</artifactId> 
      <version>3.10-FINAL</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.poi</groupId> 
      <artifactId>poi-ooxml</artifactId> 
      <version>3.10-FINAL</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>3.1</version> 
     </dependency> 

    </dependencies> 
    <build> 
     <finalName>My Automated tests</finalName> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-surefire-plugin</artifactId> 
       <version>2.16</version> 
       <configuration> 
        <suiteXmlFiles> 
         <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile> 
        </suiteXmlFiles> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 
</project> 

感謝

回答

0

需要在詹金斯添加生成後的操作以添加可以發現TestNG的,爲result.xml的相對路徑在你的工作區。

+0

我有以下作用:**在它發佈TestNG的結果 - > TestNG的XML報告模式**,這個:_ * */test-output/testng-result.xml_ – 2014-09-03 18:24:39

+0

你解決了嗎?如果未在工作區中找到testng-result.xml並添加/test-output/testng-result.xml中缺少的相對路徑infront – user3487063 2014-09-03 19:04:48

0

我會建議你在Jenkins插件中使用HTML Report Publisher Plugin並配置你的報告如下。這將允許您查看每個構建的報告。通過這個,你將能夠將所有的testNG報告建立起來,並且可以在Job級別上看到它。一旦你安裝了這個插件,配置你的工作並添加一個POST-BUILD-STEP(啓用HTML REPORT PUBLISHER)並按照testNG報告的位置設置。請參考下面的屏幕截圖,如有任何問題請告訴我。希望這可以幫助!

通常情況下,產生的TestNG的報告在這裏:

<Jenkins-Location>\jobs\<JOB_NAME>\workspace\target\html 

enter image description here