question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cucumber Json Report Context Information To Scenario/Scenario Outline [New Feature Request]

See original GitHub issue

Hi There,

I’m using the latest cucumber implmentation 1.3.0 and I’m wondering could I request a new field been written to the cucumber json that is written at the end of a test run. I believe other implementations of cucumber already support this i.e. (CucumberJVM).

For instance I have the following feature file

`Feature: Protractor_Browser_Restart

Epic: 12568

Scenario Outline: Test Naviagting To The Angular Site

User Story:
12345

Given I Go To Angular's Website And I Enter <Text> Into The Name Box
Then The Greeting Should Be <GreetingText>

Examples:
  | Text   | GreetingText           |
  | Thomas | Hello Thomas!!!!       |
  | Peter  | Hello Peter!!!!!!!!!!! |`

At the end of a test run this generates the following JSON when I register to listen to the “JsonFormatter” i.e.

this.registerListener(JsonFormatter);

JsonFormatter.log = function (JsonData)
{
}

Generated JSON below

[ { "description": " Epic:\n 12568", "elements": [ { "id": "protractor_browser_restart;test-naviagting-to-the-angular-site", "keyword": "Scenario", "line": 16, "name": "Test Naviagting To The Angular Site", "steps": [ { "arguments": [], "keyword": "Before ", "result": { "status": "passed", "duration": 4201730 }, "hidden": true, "match": { "location": "C:\\Users\\bxb145\\WebstormProjects\\Protractor_Browser_Restart\\Support\\Hooks.js:6" } }, { "arguments": [], "keyword": "Given ", "name": "I Go To Angular's Website And I Enter Thomas Into The Name Box", "result": { "status": "passed", "duration": 17782001483 }, "line": 11, "match": { "location": "C:\\Users\\bxb145\\WebstormProjects\\Protractor_Browser_Restart\\StepDefinitions\\Browse_steps.js:4" } }, { "arguments": [], "keyword": "Then ", "name": "The Greeting Should Be Hello Thomas!", "result": { "status": "passed", "duration": 106639634 }, "line": 12, "match": { "location": "C:\\Users\\bxb145\\WebstormProjects\\Protractor_Browser_Restart\\StepDefinitions\\Browse_steps.js:15" } }, { "arguments": [], "keyword": "After ", "result": { "status": "passed", "duration": 186717 }, "hidden": true, "match": { "location": "C:\\Users\\bxb145\\WebstormProjects\\Protractor_Browser_Restart\\Support\\Hooks.js:13" } } ], "tags": [], "type": "scenario" }, { "id": "protractor_browser_restart;test-naviagting-to-the-angular-site", "keyword": "Scenario", "line": 17, "name": "Test Naviagting To The Angular Site", "steps": [ { "arguments": [], "keyword": "Before ", "result": { "status": "passed", "duration": 365144 }, "hidden": true, "match": { "location": "C:\\Users\\bxb145\\WebstormProjects\\Protractor_Browser_Restart\\Support\\Hooks.js:6" } }, { "arguments": [], "keyword": "Given ", "name": "I Go To Angular's Website And I Enter Peter Into The Name Box", "result": { "status": "passed", "duration": 1394720283 }, "line": 11, "match": { "location": "C:\\Users\\bxb145\\WebstormProjects\\Protractor_Browser_Restart\\StepDefinitions\\Browse_steps.js:4" } }, { "arguments": [], "keyword": "Then ", "name": "The Greeting Should Be Hello Peter!", "result": { "status": "passed", "duration": 88420688 }, "line": 12, "match": { "location": "C:\\Users\\bxb145\\WebstormProjects\\Protractor_Browser_Restart\\StepDefinitions\\Browse_steps.js:15" } }, { "arguments": [], "keyword": "After ", "result": { "status": "passed", "duration": 138952 }, "hidden": true, "match": { "location": "C:\\Users\\bxb145\\WebstormProjects\\Protractor_Browser_Restart\\Support\\Hooks.js:13" } } ], "tags": [], "type": "scenario" } ], "id": "protractor_browser_restart", "keyword": "Feature", "line": 1, "name": "Protractor_Browser_Restart", "tags": [], "uri": "C:\\Users\\bxb145\\WebstormProjects\\Protractor_Browser_Restart\\Cucumber\\Browse.feature" } ]

The JSON has a description field at feature level that can store context information regarding the feature i.e. using the above feature file (Epic Level Business Requirement Is Set To 12568)

"description": " Epic:\n 12568",

Would it be possible to get a description field added at scenario/scenario outline level so that individual unique context can be given to the scenario and another module can use this field for display in a HTML report for example?

Let me know your thoughts? Thanks in advance. I’m aware you could add this to the “Scenario Outline” or “Scenario” but I’d like that to house what the test scenario does & description to house (for example originating business requirement of a scenario).

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
charlierudolphcommented, Sep 30, 2016

Fixed in just released 1.3.1

1reaction
charlierudolphcommented, Sep 30, 2016

@bhreinb - I have a branch with a fix for this. I will try and get a new version published with the fix this weekend.

@aslakhellesoy - It wasn’t planned currently but is something I could probably get in. Can you please create a new issue for it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Share Scenario Context in Cucumber - Tools QA
This article talks about How to Share data between Steps using Scenario Context in Cucumber in REST API Automation Testing Framework?
Read more >
Reusing Examples from Scenario Outline in separate feature file
I'm not following the file structure. From this example, it looks like there' s a separate ids.json file, a called.feature file and a...
Read more >
Cucumber Reference - Cucumber Documentation
Cucumber Reference. Cucumber can be used to implement automated tests based on scenarios described in your Gherkin feature files.
Read more >
Cucumber - Quick Guide - Tutorialspoint
We have got our feature file ready with the test scenarios defined. However, this is not the complete job done. Cucumber doesn't really...
Read more >
Step-3: Reading data files, Scenario Outline, CSV files, Callers
While coding automation scripts in the BDD approach, you should use Scenario Outline structure to achieve Data-Driven testing. You should define ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found