Failed to parse Cucumber JSON with Cucumber json test reporting plugin

692 views
Skip to first unread message

Josh Lesch

unread,
Feb 12, 2014, 5:11:30 PM2/12/14
to jenkins...@googlegroups.com
After installing this plugin and adding it to my post build, I get an error saying that it failed to archive the cucumber reports. I have to leave the report location empty because it will not locate any location I put in there. Has anybody else seen this problem?


[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

teilo

unread,
Feb 12, 2014, 6:14:34 PM2/12/14
to jenkins...@googlegroups.com
Which cucumber implementation (eg cucumber-jvm) and version are you running the tests with?
Can you put the offending Jason online somewhere?

It sounds like you have a step that is missing a resuilt , they should all have even if the step not run.

Josh Lesch

unread,
Feb 13, 2014, 9:25:12 AM2/13/14
to jenkins...@googlegroups.com
I am using the cucumber ruby implementation and its version 1.3.10. I am using an Scenario Outline with Examples. I am trying to switch to this reporting plugin because the other Cucumber Reports plugin can't handle Scenario Outlines right and always fails the build.

Scenario Outline: Verify the footer links that open in a new modal
    Given I am on website
    When I click on the "<Footer Links>" link in the footer
    Then I should see a modal pop up

  Examples:
    |Footer Links     |
    |Sign In          |
    |Create an Account|
    |Free Shipping |   

[
  {
    "keyword": "Feature",
    "name": "Footer",
    "line": 1,
    "description": "\nAs a customer\nI want to test the footer functionality\nSo I can verify that everything is working as expected",
    "id": "footer",
    "uri": "features\\footer.feature",
    "elements": [
      {
        "keyword": "Scenario Outline",
        "name": "Verify the footer links that open in a new modal",
        "line": 59,
        "description": "",
        "id": "footer;verify-the-footer-links-that-open-in-a-new-modal",
        "type": "scenario_outline",
        "steps": [
          {
            "keyword": "Given ",
            "name": "I am on website",
            "line": 60,
            "match": {
              "location": "features/step_definitions/account.rb:7"
            }
          },
          {
            "keyword": "When ",
            "name": "I click on the \"<Footer Links>\" link in the footer",
            "line": 61,
            "match": {
              "arguments": [
                {
                  "offset": 16,
                  "val": "Sign In"
                }
              ],
              "location": "features/step_definitions/footer.rb:1"
            }
          },
          {
            "keyword": "Then ",
            "name": "I should see a modal pop up",
            "line": 62,
            "match": {
              "location": "features/step_definitions/footer.rb:30"
            }
          }
        ],
        "examples": [
          {
            "keyword": "Examples",
            "name": "",
            "line": 64,
            "description": "",
            "id": "footer;verify-the-footer-links-that-open-in-a-new-modal;",
            "rows": [
              {
                "cells": [
                  "Footer Links"
                ],
                "line": 65,
                "id": "footer;verify-the-footer-links-that-open-in-a-new-modal;;1"
              },
              {
                "cells": [
                  "Sign In"
                ],
                "line": 66,
                "id": "footer;verify-the-footer-links-that-open-in-a-new-modal;;2"
              },
              {
                "cells": [
                  "Create an Account"
                ],
                "line": 67,
                "id": "footer;verify-the-footer-links-that-open-in-a-new-modal;;3"
              },
              {
                "cells": [
                  "Free Shipping"
                ],
                "line": 68,
                "id": "footer;verify-the-footer-links-that-open-in-a-new-modal;;4"
              }
            ]
          }
        ]
      }
    ]
  }
]

James Nord (jnord)

unread,
Feb 13, 2014, 10:35:23 AM2/13/14
to jenkins...@googlegroups.com

Hi Josh,

 

There’s no results at all in that json file – so the plugin won’t know if it ran ok or failed.

 

I would ask on the cucumber mailing list why the ruby implantation is missing this vital information (unless I am missing something..)

 

/James

 

 

 

 

 

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Josh Lesch

unread,
Feb 13, 2014, 10:40:07 AM2/13/14
to jenkins...@googlegroups.com, jn...@cisco.com
Yeah I noticed that when I was pasting the json on my reply. Thanks, I will check out what the cucumber people have to say about it.
Reply all
Reply to author
Forward
0 new messages