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 Standalone JSON Formatter puts regular scenario steps under the "after" section instead of the "steps" section #8

Open
Roman-Sht opened this issue Apr 22, 2021 · 5 comments

Comments

@Roman-Sht
Copy link

Summary

I am trying to use the message formatter that creates ndjson files and convert it to JSON using Cucumber Standalone JSON Formatter. However, there is a problem that after the conversion to JSON, all the scenarios steps appear in the "after" section instead in the "steps section.

Expected Behavior

Steps should go under "steps" section in the JSON

Current Behavior

Steps are put under "after" section in the JSON

Steps to Reproduce (for bugs)

cat tests.ndjson | cucumber-json-formatter --format ndjson > stand_alone_output.json

Your Environment

ruby 2.7.2
cucumber 5.1.3

input.txt

stand_alone_output.txt

Comment: had to change the file extensions to upload them. Convert the input file extension to .ndjson and the output file to .json to reproduce

@aurelien-reeves
Copy link
Contributor

Would you have the possibility to share more regarding your project like step definitions and hooks? Or a minimal reproduction example?

From what I see in your input, it looks like at least one of your After hook (features/support/hooks.rb:96) is executed after each step. That may be the cause of your issue.

Without your step definitions and hooks, or better, a minimal reproduction example, we can not go further. The issue here is not with the json formatter. Your ndjson input seems wrong.

@aslakhellesoy
Copy link
Contributor

@aurelien-reeves the supplied input.txt should be sufficient to reproduce this. Why do we need more information?

@aslakhellesoy
Copy link
Contributor

Your ndjson input seems wrong.

Well, it's what's produced by Cucumber-Ruby. Do you think there is something wrong about how Cucumber-Ruby emits messages @aurelien-reeves ?

@aurelien-reeves
Copy link
Contributor

aurelien-reeves commented Apr 22, 2021

@aurelien-reeves the supplied input.txt should be sufficient to reproduce this. Why do we need more information?

Your ndjson input seems wrong.

Well, it's what's produced by Cucumber-Ruby. Do you think there is something wrong about how Cucumber-Ruby emits messages @aurelien-reeves ?

What I see in the input.txt is something that looks like the following:

  • testCaseStarted
  • testStepStarted of a hook
  • testStepStarted of another hook
  • testStepStarted for a step definition
  • testStepStarted of a hook
  • testStepStarted for a step definition
  • testStepStarted of a hook
  • testStepStarted for a step definition
  • testStepStarted of a hook
  • ... and it continues like that until the testCaseFinished

From what I understand here is that there is a hook which is executed before or after each step. I assumed that behavior was not possible

@aurelien-reeves
Copy link
Contributor

Oh, I did not knew about Step Hooks

My mistake 😞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants