0
votes

I am using Cucumber 1.3.17 with ruby 1.9.3p545. We have nightly tests configured to run Cucumber features via Jenkins on two Windows 7 slave nodes. We use the Jenkins cucumber-reporting-0.1.0 plugin to generate pretty reports. The issue is that the plugin is frequently finding empty JSON files. This is the message in the console:

C:\Jenkins\workspace\UI_Automation\trunk\Automation\ui>exit 0 
POST BUILD TASK : SUCCESS
END OF POST BUILD TASK : 0
[CucumberReportPublisher] Compiling Cucumber Html Reports ...
[CucumberReportPublisher] Copying all json files from slave: C:\Jenkins\workspace\UI_Automation\results to master reports directory: C:\Jenkins\jobs\UI_Automation\builds\796\cucumber-html-reports
[CucumberReportPublisher] Found 1 json files.
[CucumberReportPublisher] 0. Found a json file: cucumber.json
[CucumberReportPublisher] Generating HTML reports
[Cucumber Tests] Parsing results.
[Cucumber Tests] ignoring empty file (cucumber.json)
No cucumber scenarios appear to have been run.
Build step 'Publish Cucumber test result report' changed build result to FAILURE

The problem is similar to this thread here, but I have no idea which .rb file to edit to change the exit status on failure. The file generates fine when running a single feature or scenario, but not when the full test suite.

1

1 Answers

0
votes

You can set the exit status for cucumber in features/support/env.rb

at_exit do
  begin
  e = $! # last exception
# put any post run clean up here
  ensure
    raise e if $! != e  # if there is an error then keep it
  end
end

see: http://collectiveidea.com/blog/archives/2015/01/27/cucumber-exiting-with-0-on-failure/