cucumber / cucumber/html-formatter

Built-in html formatter generates a blank html report if scenarios have not finished yet completely

Open
#120 31 comments 1 reaction 0 assignees View on GitHub
library: html-formatter type: feature
Dominant language
C#
Stars
21
Forks
6
Avg merge
1d 17h
Merged PRs (30d)
8

Description

### 👓 What did you see?

When running tests using built-in html formatter, it generates a blank HTML file *until all scenarios finished completely*.

### ✅ What did you expect to see?

HTML report to be generated should not be blank *after a scenario has been finished*

### 📦 Which tool/library version are you using?

cucumber 8.0.0
cucumber-html-formatter 19.2.0
ruby 3.1.1
Windows 10

### 🔬 How could we reproduce it?

Steps to reproduce the behavior:

1. Have more than one scenario in a test.
2. Execute cucumber --format HTML --out report.html
3. Open the html report *when test is still running* and html file is blank.

### 📚 Any additional context?

As I have not found it in the issue list, I'm picking up the issue mentioned in comment https://github.com/cucumber/cucumber-ruby/issues/1524#issuecomment-824267664 as it shows up as unacceptable drawback compared with older versions, especially when having a lot of scenarios or long scenarios or even both of this. Additionally, when issues like https://github.com/cucumber/cucumber-ruby/issues/1524 occur, the whole report is affected and not only a part of it.

written by marnen:

> Unfortunately, the way that’s done makes the Cucumber HTML report much less useful than it used to be. Back in the day, Cucumber used to use a similar approach to RSpec: it wrote straight HTML as scenarios ran, so that the file would render something useful in the browser before it was completely written. That makes it ideal for monitoring a long run with lots of scenarios.
>
> Current Cucumber HTML output, though, renders nothing until the run is complete (I think because `window.CUCUMBER_MESSAGES` isn’t well-formed JSON/JS till the final closing bracket is written), which means I need to wait for the entire run to finish before I see _any_ output. Is there an HTML formatter for current Cucumber that doesn’t have this drawback? I haven’t found one, and I really miss the old RSpec-like behavior. (And if this is off-topic, I’ll raise a new issue or ask on the list.)

answered by mattwynne:

> In fact, this kind of live monitoring of a test run from a browser should now be easier to do, given that the results are streamed out as little `ndjson` packets. The problem would be getting that stream from your Cucumber process to your browser. It's a really cool idea, but yes it is off-topic for this thread I think :) If you're interested in pursuing it, let's create a new issue (in https://github.com/cucumber/cucumber) and discuss it there.

----

*This text was originally generated from a [template](https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/about-issue-and-pull-request-templates), then edited by hand. [You can modify the template here.](https://github.com/cucumber/.github/edit/main/.github/ISSUE_TEMPLATE/bug_report.md)*

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.