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

Feature: stream Cucumber json report events #252

Open
Sanorf opened this issue Dec 12, 2024 · 6 comments
Open

Feature: stream Cucumber json report events #252

Sanorf opened this issue Dec 12, 2024 · 6 comments
Labels

Comments

@Sanorf
Copy link

Sanorf commented Dec 12, 2024

Hello,

Is it possible with the json reporter to access the results datas after each scenario execution? Currently the json file is generated only at the end of all tests execution, I would like to have more granularity to send the results more frequently to my third party test management tool.

@Sanorf Sanorf added the question Further information is requested label Dec 12, 2024
@vitalets
Copy link
Owner

Hi,

If you mean Cucumber json results, they are available only at the reporter end.
If you mean Playwright's json results, they are available in [onTestEnd(https://playwright.dev/docs/api/class-reporter#reporter-on-step-end) callbacks of the custom reporter API.

@Sanorf
Copy link
Author

Sanorf commented Dec 12, 2024

Sorry I didn't mention, I mean Cucumber json results. I would like if it is possible to not wait the end of all tests execution to get the report. This way project stakeholders can have first executed tests feedbacks more fast in their test management tool

@vitalets
Copy link
Owner

For now I'd suggest to try to use Playwright results for that task.
Which fields do you need? Playwright results contain most of the data, e.g. scenario name, passed/failing status, etc.

@Sanorf
Copy link
Author

Sanorf commented Dec 12, 2024

Results are sent to Xray API (Jira plugin): https://docs.getxray.app/display/XRAY/Import+Execution+Results+-+REST#ImportExecutionResultsREST-CucumberJSONresultsMultipart
As tests are Gherkin scenarios json results follow Cucumber json scheme

@vitalets
Copy link
Owner

The API accepts an array of items, where each item corresponds to a single feature, e.g.:

[
  {
    "keyword": "Feature",
    "name": "Feature 1",
    // ...
  },
  {
    "keyword": "Feature",
    "name": "Feature 2",
    // ...
  }
]

On the first glance, the granularity level is features. Or maybe it's possible to send a feature json with only some of the scenarios (in elements array)? Could you check that?

Anyway, currently in playwright-bdd it's not possible to stream parts of Cucumber json. But I agree this is useful feature to add.

@Sanorf
Copy link
Author

Sanorf commented Dec 12, 2024

Yes it's possible to only send json corresponding to a single feature or even a single scenario (elements level), as long as the scheme is respected.
Unfortunately i don't know how to access these stream datas on flight during the execution. I suppose they are stored somewhere in memory as all is injected in the report.json at the end.

@vitalets vitalets changed the title Question:json report generation Feature: stream Cucumber json report events Dec 16, 2024
@vitalets vitalets added thinking and removed question Further information is requested labels Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants