java.io.IOException: Failed to parse Cucumber JSON

Jenkins JIRA | James Wilson | 3 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    What we did: Ran minimal cucumber feature test with Jenkins: {code:title=Feature} Feature: Sample Test Scenario Outline: Parsing scenarios with multiple examples Given I navigate to the root page Then I see the text 'home page' Examples: | a | b | | 1 | 2 | {code} By a shell build step: {code:title=shell build} #!/bin/bash # Set up RVM (Ruby 2.0) . ~/.bashrc set -e CUCUMBER_OPTS='-f json -o cucumber.json features/sample.feature' rake cucumber {code} What we got: [::1::] What we expected: No error, parsing of cucumber.json containing results from scenario outlines. [::1::] {code:title=Output} /var/lib/jenkins/.rvm/rubies/ruby-2.0.0-p353/bin/ruby -S bundle exec cucumber -f json -o cucumber.json features/sample.feature Using the default profile... Feature: Sample Test Scenario Outline: Parsing scenarios with multiple examples # features/sample.feature:2 Given I navigate to the root page # features/step_definitions/navigation_steps.rb:15 Then I see the text 'home page' # features/step_definitions/study_admin.rb:23 Examples: | a | b | | 1 | 2 | 1 scenario (1 passed) 2 steps (2 passed) 0m1.080s Xvfb stopping Archiving artifacts [Cucumber Tests] Parsing results. [Cucumber Tests] parsing cucumber.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:914) at hudson.FilePath.act(FilePath.java:887) 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:785) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:757) at hudson.model.Build$BuildExecution.post2(Build.java:183) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:706) at hudson.model.Run.execute(Run.java:1703) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:231) 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 Finished: FAILURE {code}

    Jenkins JIRA | 3 years ago | James Wilson
    java.io.IOException: Failed to parse Cucumber JSON
  2. 0

    What we did: Ran minimal cucumber feature test with Jenkins: {code:title=Feature} Feature: Sample Test Scenario Outline: Parsing scenarios with multiple examples Given I navigate to the root page Then I see the text 'home page' Examples: | a | b | | 1 | 2 | {code} By a shell build step: {code:title=shell build} #!/bin/bash # Set up RVM (Ruby 2.0) . ~/.bashrc set -e CUCUMBER_OPTS='-f json -o cucumber.json features/sample.feature' rake cucumber {code} What we got: [::1::] What we expected: No error, parsing of cucumber.json containing results from scenario outlines. [::1::] {code:title=Output} /var/lib/jenkins/.rvm/rubies/ruby-2.0.0-p353/bin/ruby -S bundle exec cucumber -f json -o cucumber.json features/sample.feature Using the default profile... Feature: Sample Test Scenario Outline: Parsing scenarios with multiple examples # features/sample.feature:2 Given I navigate to the root page # features/step_definitions/navigation_steps.rb:15 Then I see the text 'home page' # features/step_definitions/study_admin.rb:23 Examples: | a | b | | 1 | 2 | 1 scenario (1 passed) 2 steps (2 passed) 0m1.080s Xvfb stopping Archiving artifacts [Cucumber Tests] Parsing results. [Cucumber Tests] parsing cucumber.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:914) at hudson.FilePath.act(FilePath.java:887) 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:785) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:757) at hudson.model.Build$BuildExecution.post2(Build.java:183) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:706) at hudson.model.Run.execute(Run.java:1703) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:231) 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 Finished: FAILURE {code}

    Jenkins JIRA | 3 years ago | James Wilson
    java.io.IOException: Failed to parse Cucumber JSON
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberModelException

      Step received before previous step handled!

      at org.jenkinsci.plugins.cucumber.jsontestsupport.GherkinCallback.step()
    2. org.jenkinsci.plugins
      GherkinCallback.step
      1. org.jenkinsci.plugins.cucumber.jsontestsupport.GherkinCallback.step(GherkinCallback.java:160)
      1 frame
    3. Gherkin
      JSONParser.parse
      1. gherkin.formatter.model.Step.replay(Step.java:68)
      2. gherkin.JSONParser.step(JSONParser.java:106)
      3. gherkin.JSONParser.parse(JSONParser.java:51)
      3 frames
    4. org.jenkinsci.plugins
      DefaultTestResultParserImpl$ParseResultCallable.invoke
      1. org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberJSONParser.parse(CucumberJSONParser.java:94)
      2. org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberJSONParser.parse(CucumberJSONParser.java:44)
      3. org.jenkinsci.plugins.cucumber.jsontestsupport.DefaultTestResultParserImpl$ParseResultCallable.invoke(DefaultTestResultParserImpl.java:161)
      4. org.jenkinsci.plugins.cucumber.jsontestsupport.DefaultTestResultParserImpl$ParseResultCallable.invoke(DefaultTestResultParserImpl.java:107)
      4 frames
    5. Hudson
      FilePath.act
      1. hudson.FilePath.act(FilePath.java:914)
      2. hudson.FilePath.act(FilePath.java:887)
      2 frames
    6. org.jenkinsci.plugins
      CucumberTestResultArchiver.perform
      1. org.jenkinsci.plugins.cucumber.jsontestsupport.DefaultTestResultParserImpl.parse(DefaultTestResultParserImpl.java:101)
      2. org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberJSONParser.parse(CucumberJSONParser.java:116)
      3. org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberTestResultArchiver.perform(CucumberTestResultArchiver.java:93)
      3 frames
    7. Hudson
      Executor.run
      1. hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      2. hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:785)
      3. hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:757)
      4. hudson.model.Build$BuildExecution.post2(Build.java:183)
      5. hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:706)
      6. hudson.model.Run.execute(Run.java:1703)
      7. hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      8. hudson.model.ResourceController.execute(ResourceController.java:88)
      9. hudson.model.Executor.run(Executor.java:231)
      9 frames