詹金斯发布TestNG结果不起作用 [英] Jenkins Publish TestNG Results not working
问题描述
我正在运行 Jenkins 1.571 .我正在使用pom.xml
构建我的项目.我有两个maven-surefire-plugin
执行,以分叉模式执行两个testng套件.
I am running Jenkins 1.571. I am building my project with a pom.xml
. I have two executions of maven-surefire-plugin
to execute two testng suites in a forked mode.
但是Jenkins build#/testReport页面仅显示第一个套件的测试结果.构建日志显示两个套件中的测试用例均已成功执行.
But Jenkins build#/testReport page shows test results for only first suite. Build logs show test cases from both suites are successfully executed.
我想将两个套件的结果都包含在报告中,所以我添加了Publish TestNG Results
插件,但这根本不显示任何结果.对我可能会丢失的东西有任何想法吗?
I want to include results from both suites into report, so I added Publish TestNG Results
plug-in, but that doesn't show any results at all. Any idea on what I might be missing?
在我的Jenkins配置中,我指定了'TestNG XML report pattern' = '**/target/surefire-reports/testng-results.xml'
In my Jenkins configuration, I specified 'TestNG XML report pattern' = '**/target/surefire-reports/testng-results.xml'
构建日志显示:
TestNG Reports Processing: START
Looking for TestNG results report in workspace using pattern: **/target/surefire-reports/testng-results.xml
Did not find any matching files.
Finished: SUCCESS
我相关的pom.xml:
My relevant pom.xml:
<!-- run unit test cases -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<configuration>
<environmentVariables>
<outputDirectory>${project.build.directory}</outputDirectory>
</environmentVariables>
</configuration>
<executions>
<execution>
<id>default-test</id>
<configuration>
<forkMode>once</forkMode>
<suiteXmlFiles>
<suiteXmlFile>${basedir}/src/test/testngSuite1.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</execution>
<execution>
<id>special-test</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<forkMode>always</forkMode>
<suiteXmlFiles>
<suiteXmlFile>${basedir}/src/test/testngSuite2.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</execution>
</executions>
</plugin>
推荐答案
最终,我发现我需要对TestNG插件使用正斜杠来定位文件(我的Jenkins在Windows上运行).
Eventually I found out that I need to use forward slash for TestNG plugin to locate the file (My Jenkins runs on Windows).
TestNG Reports Processing: START
Looking for TestNG results report in workspace using pattern: C:/workspace/project/target/surefire-reports/Suite1/UnitTests.xml;C:/workspace/project/target/surefire-reports/Suite2/UnitTests.xml
Saving reports...
Processing 'C:\programs\Jenkins\jobs\project\builds\2014-10-02_21-57-48\testng\testng-results-1.xml'
Processing 'C:\programs\Jenkins\jobs\project\builds\2014-10-02_21-57-48\testng\testng-results.xml'
TestNG Reports Processing: FINISH
Finished: SUCCESS
此参考资料还有助于: http://www.seleniumtests.com/p/testing-forum.html #nabble-td5001883
Also this reference helped: http://www.seleniumtests.com/p/testing-forum.html#nabble-td5001883
这篇关于詹金斯发布TestNG结果不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!