我们试图将Allure报告作为Jenkins构建的一部分进行生成。
我们已经按照文档here写了字母(除了这些说明不起作用)
按照说明我们安装了allure jenkins插件和allure-nunit适配器(按照说明将Jenx服务器上的v0.1.0 zip中包含的7个文件解压缩到NUnit 2.6.3 addins子目录中)。
控制台输出如下:
Recording NUnit tests results
Allure Report Generation: started
Allure Report Generation: find directories by mask [**/AllureResults]
Allure Report Generation: found allure result directories [C:\Program Files
(x86)\Jenkins\jobs\<myjob>\workspace\AllureResults]
Allure Report Generation: copy founded directories in directory [C:\Program Files
(x86)\Jenkins\jobs\<myjob>\workspace\allure6887431138581709111.tmp\results]
Allure Report Generation: generate report from directory [C:\Program Files
(x86)\Jenkins\jobs\<myjob>\workspace\allure6887431138581709111.tmp]
Allure Report Generation: attach report link to build and project
Allure Report Generation: Can't delete directory [C:\Program Files
(x86)\Jenkins\jobs\<myjob>\workspace\allure6887431138581709111.tmp]
java.nio.file.FileSystemException: C:\Program Files
(x86)\Jenkins\jobs\<myjob>\workspace\allure6887431138581709111.tmp\repositories\com \fasterxml\jackson\core\jackson-annotations\2.3.0\jackson-annotations-2.3.0.jar: The process
cannot access the file because it is being used by another process.
at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
at sun.nio.fs.WindowsFileSystemProvider.implDelete(Unknown Source)
at sun.nio.fs.AbstractFileSystemProvider.delete(Unknown Source)
at java.nio.file.Files.delete(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at hudson.Util.deleteFile(Util.java:247)
at hudson.Util.deleteRecursive(Util.java:310)
at hudson.Util.deleteContentsRecursive(Util.java:212)
at hudson.Util.deleteRecursive(Util.java:301)
at hudson.Util.deleteContentsRecursive(Util.java:212)
at hudson.Util.deleteRecursive(Util.java:301)
at hudson.Util.deleteContentsRecursive(Util.java:212)
at hudson.Util.deleteRecursive(Util.java:301)
at hudson.Util.deleteContentsRecursive(Util.java:212)
at hudson.Util.deleteRecursive(Util.java:301)
at hudson.Util.deleteContentsRecursive(Util.java:212)
at hudson.Util.deleteRecursive(Util.java:301)
at hudson.Util.deleteContentsRecursive(Util.java:212)
at hudson.Util.deleteRecursive(Util.java:301)
at hudson.Util.deleteContentsRecursive(Util.java:212)
at hudson.Util.deleteRecursive(Util.java:301)
at hudson.Util.deleteContentsRecursive(Util.java:212)
at hudson.FilePath$13.invoke(FilePath.java:1108)
at hudson.FilePath$13.invoke(FilePath.java:1105)
at hudson.FilePath.act(FilePath.java:918)
at hudson.FilePath.act(FilePath.java:896)
at hudson.FilePath.deleteContents(FilePath.java:1105)
at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.deleteRecursive(AllureReportPublisher.java:221)
at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.perform(AllureReportPublisher.java:143)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:770)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:734)
at hudson.model.Build$BuildExecution.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:683)
at hudson.model.Run.execute(Run.java:1770)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:89)
at hudson.model.Executor.run(Executor.java:240)
Allure Report Generation: completed
Allure并没有使构建失败,它被标记为PASSED。
在Jenkins workspace \ TestReports目录(由我的脚本创建)中,正确生成了nunit-testresults.xml文件。创建AllureResults目录并使用网站shell填充(即数据子目录对所有内容都为0)。
另一个目录allure.tmp是在Jenkins工作空间目录中创建的,该目录包含一个'results'子目录,生成的文件在数据子目录的文件中再次为0。
还创建了Jenkins工作空间目录中AllureResults目录的另一个副本。为什么呢?
在詹金斯本身,我可以点击呈现的“倾城报告”,它给了我:“测试运行(0个测试套件,0个测试套件)通过”
在我们看来,文档缺乏,但似乎也有人使用它。他们是如何让它发挥作用的?
因此导致问: 1.您是如何实际处理nunit-testresults.xml文件的? 1.我们需要安装和(或)配置其他东西吗? 1.我们应该安装诱惑核心还是包含在Jenkins Plugin或allure-nunit适配器中?
提前致谢。
继续您的建议here。
我已经安装了0.1.0的allure-nunit适配器和最新版本的allure jenkins插件。
我正在运行包含以下内容的构建步骤批处理文件:
IF NOT EXIST "%WORKSPACE%\TestReports"
(
MKDIR TestReports
)
"C:\Program Files (x86)\NUnit 2.6.3\bin\nunit-console.exe" mytest.dll /framework=net-4.0 /xml=TestReports\nunit-data-testsuite.xml
exit %%ERRORLEVEL%%
此步骤将nunit-data-testsuite.xml发送到Jenkins workspace \ TestReports目录。
我不再使用allure-cli包。
作为后期构建步骤,我按照以下步骤运行Allure Report Generation任务:
结果目录:** / TestReports 报告版本:自定义:1.41(这应该是1.39?) 生成:适用于所有构建
在allure.tmp目录中生成了东西。我看到我的nunit-data-testsuite.xml文件被复制到了allure.tmp \ results目录。
......在这一点上看起来很好。
...但是我在控制台中得到了这个:
Recording NUnit tests results
Allure Report Generation: started
Allure Report Generation: find directories by mask [**/TestReports]
Allure Report Generation: found allure result directories [C:\Program Files (x86)\Jenkins\jobs\MyTests\workspace\TestReports]
Allure Report Generation: copy founded directories in directory [C:\Program Files (x86)\Jenkins\jobs\MyTests\workspace\allure6553695529802657068.tmp\results]
Allure Report Generation: generate report from directory [C:\Program Files (x86)\Jenkins\jobs\MyTests\workspace\allure6553695529802657068.tmp]
ERROR: Publisher ru.yandex.qatools.allure.jenkins.AllureReportPublisher aborted due to exception
java.io.IOException: ru.yandex.qatools.allure.report.AllureReportBuilderException: java.lang.reflect.InvocationTargetException
at ru.yandex.qatools.allure.jenkins.utils.ReportGenerator.invoke(ReportGenerator.java:47)
at ru.yandex.qatools.allure.jenkins.utils.ReportGenerator.invoke(ReportGenerator.java:18)
at hudson.FilePath.act(FilePath.java:918)
at hudson.FilePath.act(FilePath.java:896)
at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.generateReport(AllureReportPublisher.java:211)
at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.perform(AllureReportPublisher.java:141)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:770)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:734)
at hudson.model.Build$BuildExecution.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:683)
at hudson.model.Run.execute(Run.java:1770)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:89)
at hudson.model.Executor.run(Executor.java:240)
Caused by: ru.yandex.qatools.allure.report.AllureReportBuilderException: java.lang.reflect.InvocationTargetException
at ru.yandex.qatools.allure.report.AllureReportBuilder.processResults(AllureReportBuilder.java:135)
at ru.yandex.qatools.allure.jenkins.utils.ReportGenerator.invoke(ReportGenerator.java:44)
... 14 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at ru.yandex.qatools.allure.report.AllureReportBuilder.processResults(AllureReportBuilder.java:133)
... 15 more
Caused by: ru.yandex.qatools.allure.data.ReportGenerationException: net.sf.saxon.event.NoOpenStartTagException: An attribute node (type) cannot be created after the children of the containing element
at ru.yandex.qatools.allure.data.utils.XslTransformationUtils.applyTransformation(XslTransformationUtils.java:55)
at ru.yandex.qatools.allure.data.utils.XslTransformationUtils.applyTransformation(XslTransformationUtils.java:44)
at ru.yandex.qatools.allure.data.utils.XslTransformationUtils.applyTransformation(XslTransformationUtils.java:35)
at ru.yandex.qatools.allure.data.utils.XslTransformationUtils.applyTransformations(XslTransformationUtils.java:29)
at ru.yandex.qatools.allure.data.TestRunGenerator.generate(TestRunGenerator.java:69)
at ru.yandex.qatools.allure.data.AllureReportGenerator.generate(AllureReportGenerator.java:51)
... 20 more
Caused by: net.sf.saxon.event.NoOpenStartTagException: An attribute node (type) cannot be created after the children of the containing element
at net.sf.saxon.event.NoOpenStartTagException.makeNoOpenStartTagException(NoOpenStartTagException.java:49)
at net.sf.saxon.event.ComplexContentOutputter.attribute(ComplexContentOutputter.java:296)
at net.sf.saxon.instruct.CopyOf.copyAttribute(CopyOf.java:572)
at net.sf.saxon.instruct.Copy.processLeavingTail(Copy.java:221)
at net.sf.saxon.instruct.Template.expand(Template.java:220)
at net.sf.saxon.instruct.CallTemplate$CallTemplatePackage.processLeavingTail(CallTemplate.java:440)
at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:317)
at net.sf.saxon.instruct.ApplyTemplates.apply(ApplyTemplates.java:210)
at net.sf.saxon.instruct.ApplyTemplates.processLeavingTail(ApplyTemplates.java:174)
at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:556)
at net.sf.saxon.instruct.Instruction.process(Instruction.java:93)
at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:296)
at net.sf.saxon.instruct.Template.applyLeavingTail(Template.java:203)
at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:345)
at net.sf.saxon.instruct.ApplyTemplates.apply(ApplyTemplates.java:210)
at net.sf.saxon.instruct.ApplyTemplates.process(ApplyTemplates.java:170)
at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:296)
at net.sf.saxon.instruct.Copy.processLeavingTail(Copy.java:217)
at net.sf.saxon.instruct.Template.expand(Template.java:220)
at net.sf.saxon.instruct.CallTemplate$CallTemplatePackage.processLeavingTail(CallTemplate.java:440)
at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:317)
at net.sf.saxon.instruct.ApplyTemplates.apply(ApplyTemplates.java:210)
at net.sf.saxon.instruct.ApplyTemplates.processLeavingTail(ApplyTemplates.java:174)
at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:556)
at net.sf.saxon.instruct.Instruction.process(Instruction.java:93)
at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:296)
at net.sf.saxon.instruct.Template.applyLeavingTail(Template.java:203)
at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:345)
at net.sf.saxon.instruct.ApplyTemplates.apply(ApplyTemplates.java:210)
at net.sf.saxon.instruct.ApplyTemplates.process(ApplyTemplates.java:170)
at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:296)
at net.sf.saxon.instruct.Copy.processLeavingTail(Copy.java:217)
at net.sf.saxon.instruct.Template.expand(Template.java:220)
at net.sf.saxon.instruct.CallTemplate$CallTemplatePackage.processLeavingTail(CallTemplate.java:440)
at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:317)
at net.sf.saxon.instruct.ApplyTemplates.apply(ApplyTemplates.java:210)
at net.sf.saxon.instruct.ApplyTemplates.processLeavingTail(ApplyTemplates.java:174)
at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:556)
at net.sf.saxon.instruct.Instruction.process(Instruction.java:93)
at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:296)
at net.sf.saxon.instruct.Template.applyLeavingTail(Template.java:203)
at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:345)
at net.sf.saxon.instruct.ApplyTemplates.defaultAction(ApplyTemplates.java:378)
at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:333)
at net.sf.saxon.Controller.transformDocument(Controller.java:1807)
at net.sf.saxon.Controller.transform(Controller.java:1621)
at ru.yandex.qatools.allure.data.utils.XslTransformationUtils.applyTransformation(XslTransformationUtils.java:52)
... 25 more