jenkinsci / cucumber-reports-plugin

Jenkins plugin to generate cucumber-jvm reports
https://plugins.jenkins.io/cucumber-reports/
GNU Lesser General Public License v2.1
210 stars 232 forks source link

NullPointerException whilst generating reports #5

Closed ghost closed 8 years ago

ghost commented 8 years ago

Relates to #120 on the obsolete fork.

Getting very similar looking results on version 1.0.0. Has only occurred since upgrading from 0.0.19. Project is being built on the master node. The issue seems to resolved when a file include pattern **/cucumber-report.json is manually specified. If the include pattern is left blank, then **/*.json should be the default according to the field info, however I'm unable to confirm this. Our file exclude pattern is also left blank.

Build snippet:

[CucumberReportPublisher] Found 6 json files.
...
[CucumberReportPublisher] Generating HTML reports
[CucumberReportPublisher] there was an error generating the reports: java.lang.NullPointerException
net.masterthought.cucumber.ReportBuilder.getBuildStatus(ReportBuilder.java:136)
net.masterthought.jenkins.CucumberReportPublisher.perform(CucumberReportPublisher.java:139)
hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:772)
hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:736)
hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1030)
hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:685)
hudson.model.Run.execute(Run.java:1757)
hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:519)
hudson.model.ResourceController.execute(ResourceController.java:88)
hudson.model.Executor.run(Executor.java:234)
Build step 'Publish cucumber results as a report' changed build result to FAILURE
damianszczepanik commented 8 years ago

Plugin found 6 json files and I expect that some of them are not valid and that's why it crashes. Check what is going on with this.

ghost commented 8 years ago

Okay thanks. Yeah this was the case. Some of our JUnit tests produce JSON files in the target directory.

If this NPE could be caught and logged in greater detail, that would be more helpful than the exception. I'd be willing to create a pull request for this.