ios Jenkins - 失败:未找到测试报告文件。配置错误?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/43177945/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Jenkins - failed: No test report files were found. Configuration error?
提问by iPatel
I'm beginner for "Jenkins" and following this tutorial.
我是“Jenkins”的初学者并遵循本教程。
At the Sixth stepI got below error.
在第六步我得到以下错误。
xcodebuild: error: Scheme JenkinsTest is not currently configured for the test action.
Build step 'Xcode' marked build as failure Recording test results ERROR: Step ‘Publish JUnit test result report' failed: No test report files were found. Configuration error? Finished: FAILURE
xcodebuild: error: Scheme JenkinsTest 当前未配置用于测试操作。
构建步骤“Xcode”将构建标记为失败记录测试结果错误:步骤“发布 JUnit 测试结果报告”失败:未找到测试报告文件。配置错误?完成:失败
In the Test report XMLsI did set "test-reports/.*xml"
在测试报告 XMLs我确实设置了“test-reports/.*xml”
I tried to find my solution and also many questions are founded on SO like same issue I have toobut did not get solution.
我试图找到我的解决方案,而且很多问题都是建立在 SO 上的,就像我也遇到的同样的问题,但没有得到解决方案。
I have some confusion, Is .xml file automatically generated by "Jenkins" or First we manually need to add .xml file ?
我有些困惑, .xml 文件是由“Jenkins”自动生成的还是首先我们需要手动添加 .xml 文件?
In short guide me on right direction based on above error.
简而言之,根据上述错误指导我正确的方向。
回答by Acid
First make sure junit.xml is getting generated after the test run.
首先确保在测试运行后生成 junit.xml。
Jenkins job at times cannot see past the current workspace. so it is always a good idea to copy the reports back to the current workspace before using it.
詹金斯工作有时无法超越当前工作区。因此,在使用之前将报告复制回当前工作区总是一个好主意。
cd <path to report>
cp *.xml $WORKSPACE
Now the jenkins should pick-up the report. Note: The config may show error first(since it cannot find the xml file in workspace) but after a build this should go away and also the result should get recorded
现在詹金斯应该拿起报告。注意:配置可能首先显示错误(因为它在工作区中找不到 xml 文件)但是在构建之后这应该消失并且结果应该被记录
回答by Jay P.
You can also enable the 'allowEmptyResults' option so that the junit plugin won't throw an exception when it doesn't find test results.
您还可以启用 'allowEmptyResults' 选项,以便 junit 插件在找不到测试结果时不会抛出异常。
This way it doesn't matter if the 'test-results' directory exists.
这样,“test-results”目录是否存在都无关紧要。
junit allowEmptyResults: true, testResults: '**/test-results/*.xml'
回答by alfredocambera
I'm using nosetest (python) to generate an xUnit compatible file and I was getting:
我正在使用鼻子测试(python)生成一个 xUnit 兼容文件,我得到:
ERROR: No test report files were found. Configuration error?
I was using junit plugin as:
我使用junit插件作为:
junit "test-results-unit.xml"
junit
seems to add WORKSPACE
directory by default so using the full PATH
to the file wouldn't work either. I created symlink from the resulting file to the WORKSPACE directory to make it work:
junit
似乎WORKSPACE
默认添加目录,因此使用完整PATH
的文件也不起作用。我创建了从结果文件到 WORKSPACE 目录的符号链接以使其工作:
sh 'ln -s tests/test-results-unit.xml $WORKSPACE'
junit "test-results-unit.xml"
回答by Pedro Rom?o
Thanks @Acid, it really helped me. First, copy the module/build/test-results to workspace directory
谢谢@Acid,它真的帮助了我。首先,将 module/build/test-results 复制到工作区目录
cp -r app/build/test-results $WORKSPACE/test-results
And then I used this wildcard path
然后我使用了这个通配符路径
**/test-results/**/*.xml
回答by ClemFandango
Other answers suggest copying the files to the workspace directory, but for me simply changing the path to start with '**' seemed to solve the issue
其他答案建议将文件复制到工作区目录,但对我来说,只需更改以“**”开头的路径似乎就可以解决问题
junit '**/test-reports/*.xml'
The Jenkins junit plugin pagesays that you need to "specify the path to JUnit XML files in the Ant glob syntax". I've not dug into the full details of what this means, but starting the path with '**' was enough to get it working for me.
在詹金斯的JUnit插件页说,你需要“指定路径在Ant水珠语法JUnit的XML文件”。我没有深入研究这意味着什么的全部细节,但以 '**' 开头的路径足以让它为我工作。