RAKE Cucumber + jenkins and json formated reports

573 views
Skip to first unread message

ziffification

unread,
Apr 13, 2015, 5:41:51 PM4/13/15
to cu...@googlegroups.com
Hi all!

just having some issues setting this up , this is all a local host install , what i am trying to do is produce a json report which works now that i fiddled with the perms on


"/var/lib/jenkins/workspace/RakeCucumber test"   ...bad i know ....


anyway in my rake file I have
require 'cucumber/rake/task'

Cucumber::Rake::Task.new :features do |t|
 t.cucumber_opts = '--format json features/testJson.feature > /var/lib/jenkins/workspace/RakeCucumber\ test/report.json'
end


that seems to work fine as the report gets made however some archiving function BARFS:

[Cucumber Tests] parsing report.json
ERROR: Failed to archive cucumber reports
java.io.IOException: Failed to parse Cucumber JSON
	at org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberJSONParser.parse(CucumberJSONParser.java:99)
	at org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberJSONParser.parse(CucumberJSONParser.java:44)
	at org.jenkinsci.plugins.cucumber.jsontestsupport.DefaultTestResultParserImpl$ParseResultCallable.invoke(DefaultTestResultParserImpl.java:161)
	at org.jenkinsci.plugins.cucumber.jsontestsupport.DefaultTestResultParserImpl$ParseResultCallable.invoke(DefaultTestResultParserImpl.java:107)
	at hudson.FilePath.act(FilePath.java:989)
	at hudson.FilePath.act(FilePath.java:967)
	at org.jenkinsci.plugins.cucumber.jsontestsupport.DefaultTestResultParserImpl.parse(DefaultTestResultParserImpl.java:101)
	at org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberJSONParser.parse(CucumberJSONParser.java:116)
	at org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberTestResultArchiver.perform(CucumberTestResultArchiver.java:93)
	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:761)
	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:721)
	at hudson.model.Build$BuildExecution.post2(Build.java:183)
	at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:670)
	at hudson.model.Run.execute(Run.java:1776)
	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: org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberModelException: Step received before previous step handled!
	at org.jenkinsci.plugins.cucumber.jsontestsupport.GherkinCallback.step(GherkinCallback.java:160)
	at gherkin.formatter.model.Step.replay(Step.java:68)
	at gherkin.JSONParser.step(JSONParser.java:106)
	at gherkin.JSONParser.parse(JSONParser.java:51)
	at org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberJSONParser.parse(CucumberJSONParser.java:94)
	... 17 more
Build step 'Publish Cucumber test result report' changed build result to FAILURE
[CucumberReportPublisher] Compiling Cucumber Html Reports ...
[CucumberReportPublisher] copying all json files from: /var/lib/jenkins/workspace/RakeCucumber test to reports directory: /var/lib/jenkins/jobs/RakeCucumber test/builds/10154/cucumber-html-reports
[CucumberReportPublisher] Found the following number of json files: 1
[CucumberReportPublisher] 0. Found a json file: report.json
[CucumberReportPublisher] Generating HTML reports
Finished: FAILURE

Rob Park

unread,
Apr 13, 2015, 9:39:24 PM4/13/15
to cu...@googlegroups.com
On Mon, Apr 13, 2015 at 5:41 PM, ziffification <merr...@gmail.com> wrote:
Hi all!

just having some issues setting this up , this is all a local host install , what i am trying to do is produce a json report which works now that i fiddled with the perms on


"/var/lib/jenkins/workspace/RakeCucumber test"   ...bad i know ....


anyway in my rake file I have
require 'cucumber/rake/task'

Cucumber::Rake::Task.new :features do |t|
 t.cucumber_opts = '--format json features/testJson.feature > /var/lib/jenkins/workspace/RakeCucumber\ test/report.json'
end

I'm not sure about the file append part.
There's a --out flag for the file output.
This is my Jenkins config from my cucumber.yml:
"jenkins: -p default --format junit --out out/cucumber --format html --out out/cucumber/features.html

@robpark

--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

James Nord

unread,
Apr 17, 2015, 2:41:58 PM4/17/15
to cu...@googlegroups.com
The exception says Rake is producing garbage gherkin output[1] - I'm guessing you may have a scenario outline involved in your tests?
That is there is s step and there is no corresponing Result for it.

There is an option to set in the plugin on the job configuration page ("Ignore Bad Steps").
If you set that then you life will be happy.  If you can patch Rake then you life will be even happier.


Its also not working - you just have 2 Cucumber tools installed in Jenkins (one does graphs for just a single build (which works), the other does trending and full drill down on the main page - which is failing)

/James

[1] as garbage as something can be when there exists no spec for it...

Björn Rasmusson

unread,
Apr 17, 2015, 3:45:43 PM4/17/15
to cu...@googlegroups.com
James Nord wrote:
The exception says Rake is producing garbage gherkin output[1] - I'm guessing you may have a scenario outline involved in your tests?
That is there is s step and there is no corresponing Result for it.

If you have scenario outlines and want to produce json files, you should use the --expand option, and either use Cucumber v1.3.17-19 or Cucumber v2.0 (so the fix of #700 is included).

Best Regards
Björn
 
Reply all
Reply to author
Forward
0 new messages