Thanks to visit codestin.com
Credit goes to github.com

Skip to content

JSON structure of non-binary attachments changed in 7.28.0Β #3069

@ianprime0509

Description

@ianprime0509

πŸ‘“ 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:


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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions