-
-
Notifications
You must be signed in to change notification settings - Fork 6
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-formatter (cucumber-gherkin-windows-amd64) not creating proper JSON outcome #13
Comments
Please provide an |
|
any update on this, having same issue. |
I'm also facing this issue. any update? |
@mattwynne can you remind me whether we decided to stop maintaining this tool? Personally I donβt see the need for it anymore since we decided to keep a built-in JSON formatter in all our Cucumber implementations. I donβt understand why this is needed with Cypress. If Cypress runs Cucumber, canβt it just tell Cucumber to output JSON directly? |
Hi again, Aslak I'm the author of https://github.com/badeball/cypress-cucumber-preprocessor, which is responsible for the (sudden) surge of users for this tool. Let me try to answer your question. Here's the thing, Cypress itself is a test runner, with a complete runtime and not something you can put inside of Cucumber like you can with EG. Selenium. The plugin will translate Gherkin into calls to So the plugin doesn't actually "run Cucumber", but rather re-implements it (largely, but makes use of several of your modules), despite many referring to it as "Cypress + Cucumber". It's essentially just giving familiar behavior to a tool that's not actually even remotely compatible with Cucumber. As to messages, JSON reports and this.. I developed outputting messages instead of JSON as it was significantly easier, with messages requiring little to no state in the implementation and being definitely typed. Thus appeared the sudden surge of users to https://github.com/cucumber/json-formatter. |
Expanding to this... The plugin is popular with the Cypress community. The typical user however, I suspect is fully unaware of the absence of relationship between it and Cucumber and you. The fact that it's re-implementing behavior (with feature identically being the target) remains unknown to most, I'm afraid. I know that the terminology is used carelessly in blogs, articles, guides, videos, etc. I'm sorry that you got sucked in the Cypress vortex here. It's was never my intention. Feel totally free to close indiscriminately the issues where Cypress is even mentioned. |
Ohhhhh I see! Thanks for explaining @badeball. I think it's really cool what you've done here. I'm guessing that people want Cucumber JSON output because this format is more widely supported in 3rd party reporting tools. I'm not sure how to best accommodate that need. Another alternative is to keep maintaining this library. Since it's only used by users of your cypress plugin, I think it might be better to hand it over to that community. |
Yeah, exactly. I'm fairly certain that I'm going to have to just suck it up a little bit and implement it natively myself. I benefited a lot by the existence of this though, despite no ones intention of maintaining it, it let me focus on other things for a while and I'm grateful for that. |
@davidjgoss has done a lot of refactorings in cucumber-js lately to make it more usable as a library. Iβm sure additional work would be needed to make it work in this extension, but maybe itβs worth pursuing still? Fancy scheduling a call to discuss this? Iβd love to see 1st class support for Cucumber in Cypress in a way that is supported by the official Cucumber-js implementation. |
One of the initiatives we have going in cucumber-js is the reimagining of formatters as a simpler kind of plug-in focused on messages. I think we could reimplement the existing JSON formatter in this vein such that it could be used as a function by other projects I.e. just give it a message stream. Happy to have a call! |
I would also be happy to have a call! What TZ are you two in and what time would suit you the best? |
I have used the below package to publish the cucumber report https://www.npmjs.com/package/zephyr-scale-results-publisher |
This formatter could be a good integration point: |
Sorry for the late reply @badeball - to get this scheduled, would you be able to drop into the Cucumber Slack and DM us? |
Hey @davidjgoss, sorry myself for late replying. I'm super-busy nowadays with exams, but I'll message you there when I feel it's time to re-visit this issue on my end :) |
Actually, there is. Sort of. See https://github.com/cucumber/cucumber-json-converter Weβre using this library in a commercial product to process the wildly inconsistent Cucumber JSON documents. |
I do not see how a tool that can consume many disparate formats is any help for producing a correct document. Perhaps you are saying that every one of these formats is correct but the ramifications of that aren't trivial. Could you clarify what you mean? |
What I mean is that one of the schemas in this repo could be elected the official one. Then all the implementations could be updated to conform to that schema. I donβt think it is possible to come up with a single schema that is conformant to what current Cucumbers currently output. They are too inconsistent. |
I suspect we'll run into the same problems we had when we tried to deprecate the format. There is a lot of inertia in the ecosystem. Though those problems should be less if we stay in the same ecosystem. So we could atleast share the implementation between cucumber-js and cypress. |
π What did you see?
Cucumber-report.json created by the cucumber-json-formatter for windows is not a valid JSON and also the report looks different from the Json report created in Mac system
β What did you expect to see?
Content of the json report for windows and Mac should be same and also json report should be valid
π¦ Which tool/library version are you using?
@badeball/cypress-cucumber-preprocessor": "^9.2.1",
@cypress/browserify-preprocessor": "^3.0.2",
"cypress": "latest",
"typescript": "^4.6.4"
package.json file:
"cypress-cucumber-preprocessor": {
"json": {
"enabled": true,
"formatter": "formatter/cucumber-json-formatter.exe",
"output": "reports/cucumber-report.json"
}
}
π¬ How could we reproduce it?
Steps to reproduce the behavior:
import * as browserify from "@cypress/browserify-preprocessor";
import { preprocessor } from "@badeball/cypress-cucumber-preprocessor/browserify";
import { addCucumberPreprocessorPlugin } from "@badeball/cypress-cucumber-preprocessor";
export default async(
on: Cypress.PluginEvents,
config: Cypress.PluginConfigOptions
): Promise<Cypress.PluginConfigOptions> => {
await addCucumberPreprocessorPlugin(on, config);
on(
"file:preprocessor",
preprocessor(config, {
...browserify.defaultOptions,
typescript: require.resolve("typescript"),
})
);
return config;
};
Create a feature & spec file
Create a formatter folder at root and place the latest version of cucumber-json-formatter file from https://github.com/cucumber/common/releases for windows 64 and keep without .exe extension as mentioned in the link https://github.com/badeball/cypress-cucumber-preprocessor/blob/master/docs/json-report.md
Added below section in package.json file:
"cypress-cucumber-preprocessor": {
"json": {
"enabled": true,
"formatter": "formatter/cucumber-json-formatter.exe",
"output": "reports/cucumber-report.json"
}
}
Run the npx cypress run to execute the test and create the report (cucumber-report.json)
Content of the cucumber-report.json generated in Mac and Windows should be same.
Please let me know for any additional information.
The text was updated successfully, but these errors were encountered: