Cucumber Json Report Context Information To Scenario/Scenario Outline [New Feature Request]
See original GitHub issueHi 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:
- Created 7 years ago
- Comments:8 (5 by maintainers)
Top GitHub Comments
Fixed in just released 1.3.1
@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?