-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
π What did you see?
Using this reproduction: https://github.com/ianprime0509/cucumber-attachment-repro which attaches some simple data to a scenario using a string rather than a byte array:
scenario.attach("{\"count\":" + count + "}", "application/json", "summary");
Using the json
reporting plugin, in Cucumber 7.27.2, the attachment is present in the embeddings
array using Base64 encoding: https://github.com/ianprime0509/cucumber-attachment-repro/blob/91ebb4104f0b1d298c29941b8c53ef61482b16aa/cucumber-7.27.2.json#L13-L19
However, in Cucumber 7.28.1, it is present in output
instead: https://github.com/ianprime0509/cucumber-attachment-repro/blob/91ebb4104f0b1d298c29941b8c53ef61482b16aa/cucumber-7.28.1.json#L41-L43
β What did you expect to see?
The JSON report structure should be the same as it was in version 7.27.2.
π¦ Which tool/library version are you using?
cucumber-java v7.28.1
π¬ How could we reproduce it?
This repository can be used to reproduce the issue: https://github.com/ianprime0509/cucumber-attachment-repro Run mvn test
to generate the cucumber.json
output and compare the difference between 7.27.2 and 7.28.1 by updating the POM.
π Any additional context?
Perhaps a reasonable solution would be to change the cucumber-json-formatter logic that distinguishes embedding vs output: https://github.com/cucumber/cucumber-json-formatter/blob/e413e776c0810603e6fa428c3459cb1d52a3fa9b/java/src/main/java/io/cucumber/jsonformatter/JsonReportWriter.java#L309-L324
to instead look at the special content type used for logs:
cucumber-jvm/cucumber-core/src/main/java/io/cucumber/core/runner/TestCaseState.java
Line 123 in 2b55557
"text/x.cucumber.log+plain", |
and, for compatibility, the
IDENTITY
content encoding for non-log attachments would need to result in the data
being Base64-encoded before storing it in JSON.