How to push Cypress results

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. Push every results file using cURL command

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

1 2 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

1 2 3 4 5 6 7 8 9 [ { "id": "bad-usage", "uri": "features/bad_usage.feature", "keyword": "Feature", "name": "Bad usage", ... } ]

Subset of result file for the Serve Coffee feature

1 2 3 4 5 6 7 8 9 [ { "id":"serve-coffee", "uri":"features/serve-coffee.feature", "keyword":"Feature", "name":"Serve Coffee", ... } ]

2. Push every results file using cURL command

We suppose your results files were generated in reports folder. The command will looks for every JSON file in the reports folder and send each of them using cURL command to Cucumber for Jira

1 find reports/*.json -exec curl -X POST https://c4j.cucumber.io/ci/rest/api/results -H 'authorization: $ACCESS_TOKEN_HERE' -H 'content-type: multipart/form-data' -F 'results_files[]'=@\"{}\" -F language=js;

 

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.