2017-05-07 113 views
0

我想使用maven,surefire和jenkins运行SoapUI xml项目文件。 所有的maven和jenkins都很好,在构建完成后,jenkins中显示Junit报告(带有非常基本的信息 - 测试用例名称和状态)SoapUI,Maven,Surefire和Jenkins集成

我想用surefire来显示报告和日志目标/ surfire-report/all * .xml和* .txt作为日志文件)。 如何配置jenkins以显示surefire报告和日志文件?

这里是我的pom.xml文件

<pluginRepositories> 
    <pluginRepository> 
     <id>smartbear-sweden-plugin-repository</id> 
     <url>http://www.soapui.org/repository/maven2/</url> 
    </pluginRepository> 
</pluginRepositories> 
<build> 
    <plugins> 
     <plugin> 
      <groupId>com.smartbear.soapui</groupId> 
      <artifactId>soapui-maven-plugin</artifactId> 
      <version>5.3.0</version> 
      <configuration> 
       <projectFile>${basedir}/src/test/java/Test-API-soapui-project.xml</projectFile> 
       <outputFolder>${basedir}/target/surefire-reports/</outputFolder> 
       <junitReport>true</junitReport> 
       <exportwAll>true</exportwAll> 
       <printReport>true</printReport> 
      </configuration> 
      <executions> 
       <execution> 
        <id>soapUI</id> 
        <phase>integration-test</phase> 
        <goals> 
         <goal>test</goal> 
        </goals> 
       </execution> 
      </executions> 
      <dependencies> 
       <dependency> 
        <groupId>com.smartbear.soapui</groupId> 
        <artifactId>soapui</artifactId> 
        <version>5.3.0</version> 
        <exclusions> 
         <exclusion> 
          <groupId>javafx</groupId> 
          <artifactId>jfxrt</artifactId> 
         </exclusion> 
        </exclusions> 
       </dependency> 
      </dependencies> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-surefire-report-plugin</artifactId> 
      <version>2.20</version> 
     </plugin> 
    </plugins> 
</build> 

回答

1

不知道,如果你得到了这个固定的,但是这是我做到了。

在Jenkins为您的项目构建添加发布junit测试报告结果的构建后操作。 设置测试报告XML指向您的目标/ surefire-reports目录,您在其中看到要编写的报告。 在下面的示例中,我正在config目录中存在的子模块“dev”中运行测试。 你会知道什么时候它是正确的,因为如果詹金斯找不到报告xmls,它会显示一个红色的错误信息,并没有发现报告xmls,你已经告诉他们他们会。

希望这会有所帮助。

enter image description here