Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Cucumber for Jira is only supporting JSON results of official cucumber implementations. But there is a trick to be able to push results from Cypress.

Cucumber for Jira is using this schema to validate the JSON result file received. Which means that if we can produce something that is validated by this schema, we will be able to push it in Cucumber for Jira.

That’s possible in 2 steps:

  1. Produce a JSON result files using cucumber-json-preprocessor.

  2. Create a valid JSON result file

Produce a JSON result file

Please follow installation and configuration steps described in the homepage of cucumber-json-preprocessor

Create a valid JSON result file

Let say we have two feature files : Bad Usage and Serve Coffee

Feature: Bad Usage
Feature: Serve Coffee

Cypress with cucumber-json-preprocessor

Cypress cucumber-json-preprocessor will produce one result file per feature.

You will end up with a file containing

{
  "id": "bad-usage",
  "uri": "features/bad_usage.feature",
  "keyword": "Feature",
  "name": "Bad usage",
  ...
}

And the other one will contain

{
  "id":"serve-coffee",
  "uri":"features/serve-coffee.feature",
  "keyword":"Feature",
  "name":"Serve Coffee",
  ...
}

Based on the schema, the JSON files should be an array of feature result objects.

What we are expecting

[
  {
    "id": "bad-usage",
    "uri": "features/bad_usage.feature",
    "keyword": "Feature",
    "name": "Bad usage",
    ...
  },
  {
    "id":"serve-coffee",
    "uri":"features/serve-coffee.feature",
    "keyword":"Feature",
    "name":"Serve Coffee",
    ...
  }
]

Generate a valid JSON result file

  1. I Create a new JSON file with the content :

    []
  2. I copy content of Bad Usage result file in the newly created JSON file inside the array

    [
      {
        "id": "bad-usage",
        "uri": "features/bad_usage.feature",
        "keyword": "Feature",
        "name": "Bad usage",
        ...
      }
    ]
  3. I repeat the second operation for every results generated ( don’t forget to separate object with a comma )

    [
      {
        "id": "bad-usage",
        "uri": "features/bad_usage.feature",
        "keyword": "Feature",
        "name": "Bad usage",
        ...
      },
      {
        "id":"serve-coffee",
        "uri":"features/serve-coffee.feature",
        "keyword":"Feature",
        "name":"Serve Coffee",
        ...
      }
    ]
  • No labels