Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
bhreinb opened this issue Sep 27, 2016 · 8 comments

Comments

@bhreinb
Copy link

bhreinb commented Sep 27, 2016

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).

@charlierudolph
Copy link
Member

Looking at the code it appears the description should be added if we have it. We have some unit tests that the scenario description does get output in the json formatter, though no feature tests around it.

Checking how we parse scenario outlines, it appears we lose the description when splitting it into multiple scenarios. That code lives in a dependency but I'll get the process started over to fix that.

Thanks for reporting this!

@charlierudolph
Copy link
Member

Actually appears to not be an issue with the dependency but simply that we need to get the data from elsewhere. If we want the ability to use example arguments in the description, then that is an update we would need to make on the dependency. I'll open an issue there to discuss that.

@bhreinb
Copy link
Author

bhreinb commented Sep 27, 2016

thank you 👍

@bhreinb
Copy link
Author

bhreinb commented Sep 30, 2016

Hi Charlie,

When could consumers anticipate a fix for this issue above? Many thanks in advance.

@aslakhellesoy
Copy link
Contributor

@charlierudolph are you planning to implement the new event protocol in 2.0?

@charlierudolph
Copy link
Member

charlierudolph commented 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?

@charlierudolph
Copy link
Member

Fixed in just released 1.3.1

@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants