Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

NullPointer when generating HTML report #2

Closed
jeremyGoupil opened this Issue Apr 26, 2012 · 34 comments

Comments

Projects
None yet
7 participants

Hi,

I have this little problem :

[CucumberReportPublisher] Compiling Cucumber Html Reports ...
[CucumberReportPublisher] copying json to reports directory: /data/jenkins/jobs/test-modules-cucumber-jvm/builds/2012-04-25_17-21-39/cucumber-html-reports
[CucumberReportPublisher] Generating HTML reports
ERROR: Publisher net.masterthought.jenkins.CucumberReportPublisher aborted due to exception
java.lang.NullPointerException
at net.masterthought.jenkins.FeatureReportGenerator.getAllStepStatuses(FeatureReportGenerator.java:131)
at net.masterthought.jenkins.FeatureReportGenerator.(FeatureReportGenerator.java:29)
at net.masterthought.jenkins.CucumberReportPublisher.perform(CucumberReportPublisher.java:71)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:692)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:667)
at hudson.maven.MavenModuleSetBuild$RunnerImpl.post2(MavenModuleSetBuild.java:989)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:614)
at hudson.model.Run.run(Run.java:1429)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:478)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:230)

Could you help ?

I try to fork and correct this by my self but when I try to build I obtain that :

[INFO] Failed to resolve artifact.

Missing:

  1. org.kohsuke.stapler:stapler-groovy:jar:1.169

Try downloading the file manually from the project website.

Then, install it using the command:
mvn install:install-file -DgroupId=org.kohsuke.stapler -DartifactId=stapler-groovy -Dversion=1.169 -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.kohsuke.stapler -DartifactId=stapler-groovy -Dversion=1.169 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

Path to dependency:
1) org.jenkins-ci.tools:maven-hpi-plugin:maven-plugin:1.74
2) org.kohsuke.stapler:stapler-groovy:jar:1.169

  1. org.kohsuke.stapler:stapler-jelly:jar:1.169

Try downloading the file manually from the project website.

Then, install it using the command:
mvn install:install-file -DgroupId=org.kohsuke.stapler -DartifactId=stapler-jelly -Dversion=1.169 -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.kohsuke.stapler -DartifactId=stapler-jelly -Dversion=1.169 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

Path to dependency:
1) org.jenkins-ci.tools:maven-hpi-plugin:maven-plugin:1.74
2) org.kohsuke.stapler:stapler-groovy:jar:1.169
3) org.kohsuke.stapler:stapler-jelly:jar:1.169


2 required artifacts are missing.

for artifact:
org.jenkins-ci.tools:maven-hpi-plugin:maven-plugin:1.74

from the specified remote repositories:
public (http://mvnrepository.adencf.local/nexus/content/groups/public),
repo.jenkins-ci.org (http://repo.jenkins-ci.org/public/),
central (http://repo1.maven.org/maven2),
sonatype-snapshots (https://oss.sonatype.org/content/repositories/snapshots),
public-snapshots (http://mvnrepository.adencf.local/nexus/content/groups/public-snapshots)

@ghost ghost assigned kingsleyh Apr 26, 2012

Collaborator

kingsleyh commented Apr 26, 2012

Hi - I will check into the first issue of not being able to generate the HTML reports as well.

Your second issue of not being able to build the project is probably because you need to put some config in your maven settings in your .m2 directory - have a look on this page for the xml:

https://wiki.jenkins-ci.org/display/JENKINS/Plugin+tutorial

Collaborator

kingsleyh commented Apr 26, 2012

Also - could you give me more details about the type of jenkins project you made? Is it a regular freestyle project or something else? Also what operating system are you running on and which version of Jenkins do you have?

Collaborator

kingsleyh commented Apr 26, 2012

Oh my code assumes you have either a scenario or a scenario outline at least. Maybe you can give an example of the feature file you are using. I should make some changes to handle when there are no feature and scenario keyword.

Collaborator

kingsleyh commented Apr 26, 2012

I have just done some investigation - and it seems with cucumber-jvm you must supply the feature keyword and a scenario keyword at least. But your error message seems consistent with the scenario keyword missing.

Hi,

We use Jenkins ver. 1.440, on Debian linux.

We use Feature: text
resume text
Scenario:
Given contextStep
Scenario: description text
When stepA
Then stepB :
| verify A | verify B |

Feature are UTF-8 encoding style we use french word for the description like "démarre" is that a problem ?

Collaborator

kingsleyh commented Apr 26, 2012

Hi - ok then this seems fine. I have version 1.456 - and I use a freestyle project. It doesn't seem to work for other project types - e.g the maven project type.

Collaborator

kingsleyh commented Apr 26, 2012

I'm not sure about the french word description - you'll have to experiment and see if that is causing the issue.

Can you publish your freetyle project configuration or an example ?

Collaborator

kingsleyh commented Apr 26, 2012

my freestyle project config is very simple - I only have 4 things:

  1. the project name (which is mandatory)
  2. In Advanced project options I set the custom workspace to point to my project directory when running locally
    Or if running on the build server I just set the source control to check out my repo
  3. I add a build step - execute shell - which has mvn clean install
  4. I tick the cucumber-reports plugin and put target in the first field and leave the second one empty

Thats pretty much it

I try with feestyle type project and have the same issue.

I leave the second one empty but we are in this configuration host:port/jenkins/ and i don't get what to put in,
i try host:port/jenkins/cucumber-reports

Collaborator

kingsleyh commented Apr 26, 2012

hi

If you are in configuration host:port/jenkins as the root to your jenkins install

then in box 2 you should put: /jenkins/

if your installation was at host:port/myserver/jenkins
then you would put /myserver/jenkins/

if your have your jenkins installed at host:port then just leave box 2 empty

hope that helps

On 26 Apr 2012, at 10:23, Jérémy Goupil wrote:

I try with feestyle type project and have the same issue.

I leave the second one empty but we are in this configuration host:port/jenkins/ and i don't get what to put in,
i try host:port/jenkins/cucumber-reports


Reply to this email directly or view it on GitHub:
masterthought#2 (comment)

The same issue :

[CucumberReportPublisher] Compiling Cucumber Html Reports ...

[CucumberReportPublisher] copying json to reports directory: /data/jenkins/jobs/cucumber-jvm-with-reports/builds/2012-04-26_11-27-25/cucumber-html-reports
[CucumberReportPublisher] Generating HTML reports
ERROR: Publisher net.masterthought.jenkins.CucumberReportPublisher aborted due to exception
java.lang.NullPointerException
at net.masterthought.jenkins.FeatureReportGenerator.getAllStepStatuses(FeatureReportGenerator.java:131)
at net.masterthought.jenkins.FeatureReportGenerator.(FeatureReportGenerator.java:29)
at net.masterthought.jenkins.CucumberReportPublisher.perform(CucumberReportPublisher.java:71)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:692)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:667)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:645)
at hudson.model.Build$RunnerImpl.post2(Build.java:162)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:614)
at hudson.model.Run.run(Run.java:1429)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:230)

Collaborator

kingsleyh commented Apr 26, 2012

hi

could you send me the json file that is generated. in this directory there should be a json file:

/data/jenkins/jobs/cucumber-jvm-with-reports/builds/2012-04-26_11-27-25/cucumber-html-reports

--K

On 26 Apr 2012, at 10:30, Jérémy Goupil wrote:

The same issue :

[CucumberReportPublisher] Compiling Cucumber Html Reports ...

[CucumberReportPublisher] copying json to reports directory: /data/jenkins/jobs/cucumber-jvm-with-reports/builds/2012-04-26_11-27-25/cucumber-html-reports
[CucumberReportPublisher] Generating HTML reports
ERROR: Publisher net.masterthought.jenkins.CucumberReportPublisher aborted due to exception
java.lang.NullPointerException
at net.masterthought.jenkins.FeatureReportGenerator.getAllStepStatuses(FeatureReportGenerator.java:131)
at net.masterthought.jenkins.FeatureReportGenerator.(FeatureReportGenerator.java:29)
at net.masterthought.jenkins.CucumberReportPublisher.perform(CucumberReportPublisher.java:71)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:692)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:667)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:645)
at hudson.model.Build$RunnerImpl.post2(Build.java:162)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:614)
at hudson.model.Run.run(Run.java:1429)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:230)


Reply to this email directly or view it on GitHub:
masterthought#2 (comment)

Collaborator

kingsleyh commented Apr 26, 2012

The Gson parser doesn't seem to be able to cope with the encoding. The json contains: name":"je recherche le libellé "xyz" sur l\u0027auto-complétion"

and Gson says:
Exception in thread "main" com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: For input string: "
002"

I'm looking for a fix

On 26 Apr 2012, at 10:30, Jérémy Goupil wrote:

The same issue :

[CucumberReportPublisher] Compiling Cucumber Html Reports ...

[CucumberReportPublisher] copying json to reports directory: /data/jenkins/jobs/cucumber-jvm-with-reports/builds/2012-04-26_11-27-25/cucumber-html-reports
[CucumberReportPublisher] Generating HTML reports
ERROR: Publisher net.masterthought.jenkins.CucumberReportPublisher aborted due to exception
java.lang.NullPointerException
at net.masterthought.jenkins.FeatureReportGenerator.getAllStepStatuses(FeatureReportGenerator.java:131)
at net.masterthought.jenkins.FeatureReportGenerator.(FeatureReportGenerator.java:29)
at net.masterthought.jenkins.CucumberReportPublisher.perform(CucumberReportPublisher.java:71)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:692)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:667)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:645)
at hudson.model.Build$RunnerImpl.post2(Build.java:162)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:614)
at hudson.model.Run.run(Run.java:1429)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:230)


Reply to this email directly or view it on GitHub:
masterthought#2 (comment)

ok thx you're reactivity !

for*

Collaborator

kingsleyh commented Apr 27, 2012

Hi,

I fixed your problem - so it should work now. Let me know if you have any other issues. I also added duration to this version - it's in the download section.

@kingsleyh kingsleyh closed this Apr 27, 2012

Hi,

I have always the same issue, you're sources are encoding in UTF-8 or ISO-8859-15 ?

Collaborator

kingsleyh commented May 2, 2012

Did you install the latest version of the plugin - which I put in the downloads area? version 0.0.5 ? In that version I took the json that you gave me and I was able to parse it and display the report ok. The main issue seems to be that cucumber-jvm is generating some json where the \0027 in a couple of cases is split across a newline e.g.

0027

this causes the GSON google json parser to throw an exception when it parses it. my workaround was to replace all the \0027 and similar escape sequences with the actual value e.g. a ' - it seemed to work for me.

I'll have to ask the cucumber guys to have a look at the json generation to see what is up.

--K

On 2 May 2012, at 12:15, Jérémy Goupil wrote:

Hi,

I have always the same issue, you're sources are encoding in UTF-8 or ISO-8859-15 ?


Reply to this email directly or view it on GitHub:
masterthought#2 (comment)

Yes I did download version 0.0.5 of the plugin and my cucumber-jvm version is the 1.0.4.

Hello, it works.
It was configuration problem and cucumber-jvm reporter problem.

Big thank's you for you're help.

Hi,

got the same issue with NPE.

As we also use the feature files for documentation, not all of our feature files include a scenario. Cucumber-jvm itself does not have a problem with those files and generates the JSON Files propberly.

So any chance, that the report plugin also supports relaxed parsing and allows feature files without a scenario?

Collaborator

kingsleyh commented Jun 11, 2012

Hi

Currently the Gson parser parses in a heirarchy - feature -> element (scenario) -> step defs

Can you send me your json file that contains a feature without a scenario and I will see what I can do

--Kingsley

On 11 Jun 2012, at 11:28, Christian Zulehner wrote:

Hi,

got the same issue with NPE.

As we also use the feature files for documentation, not all of our feature files include a scenario. Cucumber-jvm itself does not have a problem with those files and generates the JSON Files propberly.

So any chance, that the report plugin also supports relaxed parsing and allows feature files without a scenario?


Reply to this email directly or view it on GitHub:
masterthought#2 (comment)

Hi,
just sent you a file...
thanx in advance
Chris

Hi,
just sent you a file...
thanx in advance
Chris

Collaborator

kingsleyh commented Jun 15, 2012

I have fixed this issue now - the latest version 0.0.12 is in the downloads area. The plugin now handles when there are no scenarios or no steps and tries to publish a report with what it can.
I ran the feature file you gave me and it published the report fine now :)

--k

On 13 Jun 2012, at 14:18, Christian Zulehner wrote:

Hi,
just sent you a file...
thanx in advance
Chris


Reply to this email directly or view it on GitHub:
masterthought#2 (comment)

Downloaded and installed it. Had to remove old plugin versions first, Jenkins didn't recognize the new version.

Seems to work like a charm now!

Thanks a lot!

Collaborator

kingsleyh commented Jun 18, 2012

Excellent - glad it's working for you :)

On 18 Jun 2012, at 10:58, Christian Zulehner wrote:

Downloaded and installed it. Had to remove old plugin versions first, Jenkins didn't recognize the new version.

Seems to work like a charm now!

Thanks a lot!


Reply to this email directly or view it on GitHub:
masterthought#2 (comment)

I'm having a similar issue,m here is what I get in the console output

[CucumberReportPublisher] Compiling Cucumber Html Reports ...
[CucumberReportPublisher] copying all json files from slave: /var/jenkins/workspace/Allure_test_job to master reports directory: /var/lib/jenkins/jobs/Allure_test_job/builds/2015-01-23_15-51-16/cucumber-html-reports
[CucumberReportPublisher] Found the following number of json files: 1
[CucumberReportPublisher] 0. Found a json file: results.json
[CucumberReportPublisher] Generating HTML reports
[CucumberReportPublisher] there was an error generating the reports: java.lang.NullPointerException
net.masterthought.cucumber.ReportBuilder.getBuildStatus(ReportBuilder.java:76)
net.masterthought.jenkins.CucumberReportPublisher.perform(CucumberReportPublisher.java:112)
hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:770)
hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:734)
hudson.model.Build$BuildExecution.post2(Build.java:183)
hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:683)
hudson.model.Run.execute(Run.java:1784)
hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
hudson.model.ResourceController.execute(ResourceController.java:89)
hudson.model.Executor.run(Executor.java:240)

I would appreciate any ideas or suggestions

JimFung commented Nov 5, 2015

@chaitanyachannella I am running into the same issue, did you ever find a fix for it?

Owner

damianszczepanik commented Nov 5, 2015

Upgrade the plugin

JimFung commented Nov 6, 2015

@damianszczepanik updating the plugin fixed it. thanks

Hi Can You help on this.

Error
Something went wrong with project master, build 140

java.lang.NullPointerException
Trying to generate report from following files. Make sure they are valid cucumber report files:
/var/lib/jenkins/jobs/REST-Digital/jobs/cc-account-pin/branches/master/builds/140/cucumber-html-reports/.cache/cucumber.json
/var/lib/jenkins/jobs/REST-Digital/jobs/cc-account-pin/branches/master/builds/140/cucumber-html-reports/.cache/features/config/change-mail-digital/CanChipCards.json
/var/lib/jenkins/jobs/REST-Digital/jobs/cc-account-pin/branches/master/builds/140/cucumber-html-reports/.cache/features/config/change-mail-digital/CanNonChipCards.json
/var/lib/jenkins/jobs/REST-Digital/jobs/cc-account-pin/branches/master/builds/140/cucumber-html-reports/.cache/features/config/change-mail-digital/USChipCards.json
/var/lib/jenkins/jobs/REST-Digital/jobs/cc-account-pin/branches/master/builds/140/cucumber-html-reports/.cache/features/config/change-mail-digital/USNonChipCards.json
/var/lib/jenkins/jobs/REST-Digital/jobs/cc-account-pin/branches/master/builds/140/cucumber-html-reports/.cache/features/config/change-mail-digital/new.json
/var/lib/jenkins/jobs/REST-Digital/jobs/cc-account-pin/branches/master/builds/140/cucumber-html-reports/.cache/features/config/mail-digital/CanChipCards.json
/var/lib/jenkins/jobs/REST-Digital/jobs/cc-account-pin/branches/master/builds/140/cucumber-html-reports/.cache/features/config/mail-digital/CanNonChipCards.json
/var/lib/jenkins/jobs/REST-Digital/jobs/cc-account-pin/branches/master/builds/140/cucumber-html-reports/.cache/features/config/mail-digital/USChipCards.json
/var/lib/jenkins/jobs/REST-Digital/jobs/cc-account-pin/branches/master/builds/140/cucumber-html-reports/.cache/features/config/mail-digital/USNonChipCards.json
/var/lib/jenkins/jobs/REST-Digital/jobs/cc-account-pin/branches/master/builds/140/cucumber-html-reports/.cache/features/config/mail-digital/new.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment