Andrew Gray
Andrew Gray

Reputation: 3661

Configuration and Getting Started with Allure and NUnit

We have tried to get Allure reports generating as part of our Jenkins build.

We have followed the documentation here to the letter (except these instruction just don't work)

In following the instructions we have installed the allure jenkins plugin and the allure-nunit adapter (extracting the 7 files contained in the v0.1.0 zip to NUnit 2.6.3 addins subdirectory on Jenkins server, as instructed).

Console output is as follows:

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 does not fail the build, it is marked as PASSED.

Within the Jenkins workspace\TestReports directory (created by my script) the nunit-testresults.xml file is correctly generated. The AllureResults directory is created and populated with a website shell (i.e. the data subdirectory has 0's against everything).

Another directory allure.tmp is created in the Jenkins workspace directory which includes a 'results' subdirectory, with generated files but 0's again in the files in the data subdirectory.

Also created is another copy of the AllureResults directory in the Jenkins workspace directory. Why?

In Jenkins itself I can click on the rendered "Allure Report" which gives me: "Test run (0 testsuites, 0 testcases) PASSED"

It appears to us the documentation is lacking, however it also appears there are people using it. How did they get it working?

Therefore are led to ask: 1. How did you get it to actually process the nunit-testresults.xml file? 1. Is there something else we need to install and(or) configure? 1. Are we supposed to install allure-core or is it included in the Jenkins Plugin or allure-nunit adapter?

Thanks in advance.


Further to your suggestions here.

I have installed 0.1.0 of the allure-nunit adapter and the latest version of the allure jenkins plugin.

I am running a build step batch file with the following content:

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%%

This step is emitting nunit-data-testsuite.xml to the Jenkins workspace\TestReports directory.

I am NO LONGER running the allure-cli package.

As a post build step I run the Allure Report Generation task configure as follows:

Results Directories: **/TestReports Report Version: Custom: 1.41 (should this be 1.39?) Generate: For All Builds

Stuff got generated in the allure.tmp directory. I see that my nunit-data-testsuite.xml file was copied to the allure.tmp\results directory.

...looking good at this point.

...but then I got this in the console:

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 

Upvotes: 2

Views: 3784

Answers (1)

vania-pooh
vania-pooh

Reputation: 2977

  1. This exception is caused by Jenkins issue.
  2. You're only supposed to install Jenkins plugin and run your tests with NUnit adapter enabled. That's all. Nothing else. Also see the details in the following issue.

Upvotes: 1

Related Questions