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

« Previous Version 2 Current »

Cucumber for Jira is only supporting JSON results generated from official cucumber implementations. However you can also upload results generated from Cypress with 2 additional steps.

Cucumber for Jira is using this JSON schema to validate the uploaded result file. This means that any result file validated against this schema will be accepted by Cucumber for Jira.

That’s possible in 2 steps:

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

  2. Transform your JSON result files into one result file accepted by Cucumber for Jira

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

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

Let say we have two feature files : bad_usage.feature and serve_coffee.feature

Feature: Bad Usage
Feature: Serve Coffee

Executing your test after configuring cucumber-json-preprocessor will produce 2 result files: one result file per feature.

Subset of result file for the Bad Usage feature

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

Subset of result file for the Serve Coffee feature

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

2. Transform your JSON result files into one result file accepted by Cucumber for Jira

Cucumber for Jira expects an array of feature results as shown below

[
  {
    "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",
    ...
  }
]

So you need to aggregate the content of each result file produced by cucumber-json-preprocessor in a single JSON file. These are the steps you should follow in the above example with our 2 feature files

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

    []

  2. Copy all the result file content for Bad Usage between the brackets into the newly created JSON file:

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

  3. Repeat the second operation for the content of every result file generated cucumber-json-preprocessor. In our example, the result file content for the Serve Coffee feature
    Pay attention to add a comma between each result file content as follow:

    [
      {
        "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",
        ...
      }
    ]

Voilà! You should be able to upload the consolidated JSON file into Cucumber for Jira.
You could automate these steps to include them in a CI tool.

  • No labels