2014-09-03 136 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