damianszczepanik / cucumber-reporting-jenkins

Java jenkins plugin for cucumber-jvm reporting
151 stars 12 forks source link

[Ruby]Error when generating report #33

Closed yasuoza closed 8 years ago

yasuoza commented 12 years ago

Hi,

This plugin seems cool, so I tried this but failed when generating report.

Following error message was shown in jenkins job console.

[CucumberReportPublisher] Compiling Cucumber Html Reports ...
[CucumberReportPublisher] detected this build is running on the master 
[CucumberReportPublisher] copying json to reports directory: /var/lib/jenkins/jobs/RingNote-AT/builds/2012-08-24_17-03-50/cucumber-html-reports
[CucumberReportPublisher] Generating HTML reports
ERROR: Publisher net.masterthought.jenkins.CucumberReportPublisher aborted due to exception
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2
    at com.google.gson.Gson.fromJson(Gson.java:802)
    at com.google.gson.Gson.fromJson(Gson.java:757)
    at com.google.gson.Gson.fromJson(Gson.java:706)
    at com.google.gson.Gson.fromJson(Gson.java:678)
    at net.masterthought.cucumber.ReportParser.parseJsonResults(ReportParser.java:30)
    at net.masterthought.cucumber.ReportParser.<init>(ReportParser.java:18)
    at net.masterthought.cucumber.ReportBuilder.<init>(ReportBuilder.java:31)
    at net.masterthought.jenkins.CucumberReportPublisher.perform(CucumberReportPublisher.java:98)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
    at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:710)
    at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:685)
    at hudson.model.Build$RunnerImpl.post2(Build.java:162)
    at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:632)
    at hudson.model.Run.run(Run.java:1463)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:239)
Caused by: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2
    at com.google.gson.stream.JsonReader.expect(JsonReader.java:339)
    at com.google.gson.stream.JsonReader.beginArray(JsonReader.java:306)
    at com.google.gson.internal.bind.ArrayTypeAdapter.read(ArrayTypeAdapter.java:70)
    at com.google.gson.Gson.fromJson(Gson.java:791)
    ... 16 more

Error message seems like issue #17, but I'm using cucumber-reports version 0.0.14 on jenkins 1.466.1. Thank you for help.

kingsleyh commented 12 years ago

hi - hmm haven't seen that error before - I'll try to have a look - could you send me your cucumber.json to kingsley@mindflowsolutions.com to be honest I'm flat out at work at the moment so haven't had much time to address the issues - but I will get there eventually :) On 24 Aug 2012, at 09:14, YasuOza notifications@github.com wrote:

Hi,

This plugin seems cool, so I tried this but failed when generating report.

Following error message was shown in jenkins job console.

[CucumberReportPublisher] Compiling Cucumber Html Reports ... [CucumberReportPublisher] detected this build is running on the master [CucumberReportPublisher] copying json to reports directory: /var/lib/jenkins/jobs/RingNote-AT/builds/2012-08-24_17-03-50/cucumber-html-reports [CucumberReportPublisher] Generating HTML reports ERROR: Publisher net.masterthought.jenkins.CucumberReportPublisher aborted due to exception com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 at com.google.gson.Gson.fromJson(Gson.java:802) at com.google.gson.Gson.fromJson(Gson.java:757) at com.google.gson.Gson.fromJson(Gson.java:706) at com.google.gson.Gson.fromJson(Gson.java:678) at net.masterthought.cucumber.ReportParser.parseJsonResults(ReportParser.java:30) at net.masterthought.cucumber.ReportParser.(ReportParser.java:18) at net.masterthought.cucumber.ReportBuilder.(ReportBuilder.java:31) at net.masterthought.jenkins.CucumberReportPublisher.perform(CucumberReportPublisher.java:98) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19) at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:710) at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:685) at hudson.model.Build$RunnerImpl.post2(Build.java:162) at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:632) at hudson.model.Run.run(Run.java:1463) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:239) Caused by: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 at com.google.gson.stream.JsonReader.expect(JsonReader.java:339) at com.google.gson.stream.JsonReader.beginArray(JsonReader.java:306) at com.google.gson.internal.bind.ArrayTypeAdapter.read(ArrayTypeAdapter.java:70) at com.google.gson.Gson.fromJson(Gson.java:791) ... 16 more Error message seems like issue #17, but I'm using cucumber-reports version 0.0.14 on jenkins 1.466.1. Thank you for help.

— Reply to this email directly or view it on GitHub.

yasuoza commented 12 years ago

Thanks for help!

I sent you a email with cucumber.json.

hgontijo commented 12 years ago

Hi,

I'm getting the same issue - please see below console output. The build is running on a slave and the json was properly copied to master. I setup an another Jenkins instance - single node without slaves, setup a fake job to create cucumber reports, used the same json files and it worked well. Not sure if it's related.

Using v0.0.12.

Any clues on that?

[CucumberReportPublisher] Compiling Cucumber Html Reports ... [CucumberReportPublisher] detected this build is running on a slave [CucumberReportPublisher] copying json from: file:/opt/jenkins_home/workspace/mvp1-acceptance-tests/to reports directory: file:/opt/jenkins_home/jobs/mvp1-acceptance-tests/builds/2012-09-21_10-32-05/cucumber-html-reports/ [CucumberReportPublisher] Generating HTML reports ERROR: Publisher net.masterthought.jenkins.CucumberReportPublisher aborted due to exception com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 at com.google.gson.Gson.fromJson(Gson.java:802) at com.google.gson.Gson.fromJson(Gson.java:757) at com.google.gson.Gson.fromJson(Gson.java:706) at com.google.gson.Gson.fromJson(Gson.java:678) at net.masterthought.jenkins.FeatureReportGenerator.parseJsonResults(FeatureReportGenerator.java:54) at net.masterthought.jenkins.FeatureReportGenerator.(FeatureReportGenerator.java:36) at net.masterthought.jenkins.CucumberReportPublisher.perform(CucumberReportPublisher.java:96) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19) at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:697) at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:672) at hudson.maven.MavenModuleSetBuild$RunnerImpl.post2(MavenModuleSetBuild.java:997) at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:619) at hudson.model.Run.run(Run.java:1429) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:481) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:238) Caused by: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 at com.google.gson.stream.JsonReader.expect(JsonReader.java:339) at com.google.gson.stream.JsonReader.beginArray(JsonReader.java:306) at com.google.gson.internal.bind.ArrayTypeAdapter.read(ArrayTypeAdapter.java:70) at com.google.gson.Gson.fromJson(Gson.java:791) ... 15 more Notifying upstream projects of job completion Finished: FAILURE

Thanks,

Henrique

smarmit commented 12 years ago

@rvaughn: We've run into Issue #27 as well. I implemented the suggested fix and that got us to this point. So yes, they are related, but that one doesn't fix this one. It seems that this plugin might be restricted to jobs running on master at this stage of development.

rvaughn commented 12 years ago

@smarmit: I didn't mean to imply that #27 is the sole cause of this one - sorry about that. I only meant that in the right circumstances it can cause an issue that looks a whole lot like #33. Sorry for the confusion!

smarmit commented 12 years ago

@rvaughn: No problem at all. I was only pointing out that while they are related, they also require individual fixes. Thanks for the reply.

tsgautier commented 11 years ago

I am getting the same problem. Looking at the json created by the ruby version of cucumber, it appears to output the results of each feature as an array, like this:

[ { url: ... }, { url: ... } ]

this is, as far as I can tell, perfectly legal JSON, at least a recent version of node.js likes it, but gson for some reason doesn't. I don't know what format the cucumber-jvm json output should be, maybe someone using the java version can have a look at their cucumber.json and we can figure out what is slightly different.

tsgautier commented 11 years ago

update - I was able to get past this problem by downloading and compiling the newest version of the source code. it seems the binaries available on github are quite old.

unfortunately, even though I see this in the output of my build job, all I get is a 404 :(.

[CucumberReportPublisher] Compiling Cucumber Html Reports ...
[CucumberReportPublisher] detected this build is running on the master 
[CucumberReportPublisher] copying json to reports directory: /var/lib/jenkins/jobs/push_promotions/builds/2012-11-27_03-18-54/cucumber-html-reports
[CucumberReportPublisher] Generating HTML reports

Looking on the filesystem I see cucumber.json has been copied to the right spot, so not sure what needs to happen now :(

kingsleyh commented 11 years ago

This issue might possibly be related to other json files being found on the path causing the plugin to blow up on a json file which isn't a report file. But I'm not sure - perhaps being more specific with the path to the directory containing the report json file in the job config would help?

kingsleyh commented 11 years ago

The latest version just released should fix this issue: 0.0.20

yasuoza commented 11 years ago

Thank you for your improvement! I'll try it later.

seleniumbheema commented 9 years ago

Still I'm getting this issue, please see my Error below

[INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.298 s [INFO] Finished at: 2015-10-28T14:59:20+00:00 [INFO] Final Memory: 11M/310M [INFO] ------------------------------------------------------------------------ ERROR: Maven JVM terminated unexpectedly with exit code 0 [CucumberReportPublisher] Compiling Cucumber Html Reports ... [CucumberReportPublisher] detected this build is running on the master [CucumberReportPublisher] copying json to reports directory: /Users/Shared/Jenkins/Home/jobs/Appium_IOS_maven/builds/45/cucumber-html-reports [CucumberReportPublisher] Generating HTML reports Finished: FAILURE

damianszczepanik commented 9 years ago

Did you check this first? https://www.google.pl/search?q=ERROR:+Maven+JVM+terminated+unexpectedly+with+exit+code+0

seleniumbheema commented 9 years ago

@damianszczepanik i've tired everything but still getting below error.

i can email you my POM xml, if you want.

ERROR: Maven JVM terminated unexpectedly with exit code 1 [CucumberReportPublisher] Compiling Cucumber Html Reports ... [CucumberReportPublisher] detected this build is running on the master [CucumberReportPublisher] copying json to reports directory: /Users/Shared/Jenkins/Home/jobs/Appium_IOS_maven/builds/59/cucumber-html-reports [CucumberReportPublisher] Generating HTML reports Finished: FAILURE

damianszczepanik commented 9 years ago

Attach json file so I can check if this is plugin problem or the source is located out of the plugin.