Describe the bug
When outputting HTML report with Scenario Template, Scenario::attach only works for the first scenario in a Scenario Outline.
To Reproduce
- Create a test case as follows:
Feature: attach data to HTML report
Scenario Template: test
Then store '<val>'
Examples:
| val |
| foo |
| bar |
package org.example;
import io.cucumber.java.After;
import io.cucumber.java.Scenario;
import io.cucumber.java.en.Then;
public class StepDefinitions {
private String text;
@Then("store {string}")
public void store(String t) {
this.text = t;
}
@After
public void attach(Scenario s) {
String line = s.getLine().toString();
s.attach("val: " + this.text, "text/plain", line);
System.out.println(this.text + " attached");
this.text = "";
}
}
package org.example;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@CucumberOptions(plugin = {"html:target/report.html"})
public class RunCucumberTest {
}
- Run
mvn test
- Both
foo attached and bar attached are displayed on my console, but target/report.html only shows val: foo.
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
Running org.example.RunCucumberTest
foo attached
bar attached
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.642 sec
...
Expected behavior
target/report.html shows both val: foo and val: bar.
Context & Motivation
For example, When some tests fails, we can get addtional information for each test that has parameters from HTML report. These are helpful for debugging.
Screenshots

Environment
- Cucumber Version: 6.7.0
- OS: Windows 10 1909
- Runtime: OpenJDK 14.0.2
- Build tool: Apache Maven 3.6.3
- Browser: Google Chrome 85.0.4183.121
Additional context
It seems that val: bar is found in window.CUCUMBER_MESSAGES but not renderd.
$ grep -o -E "val:\s(foo|bar)" target/report.html
val: foo
val: bar
Describe the bug
When outputting HTML report with Scenario Template,
Scenario::attachonly works for the first scenario in a Scenario Outline.To Reproduce
mvn testfoo attachedandbar attachedare displayed on my console, buttarget/report.htmlonly showsval: foo.Expected behavior
target/report.htmlshows bothval: fooandval: bar.Context & Motivation
For example, When some tests fails, we can get addtional information for each test that has parameters from HTML report. These are helpful for debugging.
Screenshots
Environment
Additional context
It seems that
val: baris found inwindow.CUCUMBER_MESSAGESbut not renderd.