cucumber / cucumber-cpp

Support for writing Cucumber step definitions in C++
MIT License
306 stars 131 forks source link

Add ability to send embeddings through the wire protocol #223

Closed Sigill closed 2 years ago

Sigill commented 5 years ago

Summary

Motivation and Context

I'm looking into cucumber-cpp for my company. We need to be able to embed text or images into the reports, but that feature is not available when using the wire protocol.

This patch is the 4th of a series of 4, respectively impacting cucumber-ruby, cucumber-ruby-core, cucumber-ruby-wire and cucumber-cpp.

Basically, the idea is to allow embeddings to be specified in the success or fail responses sent through the wire protocol. E.g.:

["success",{"embeddings":[{"label":"Embedded text","mime_type":"text/plain","src":"Some text"}]}]
["fail",{"embeddings":[{"label":"Embedded image","mime_type":"image/png;base64","src":"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg=="}],"message":"There was no  banana"}]

The patch on cucumber-ruby (cucumber/cucumber-ruby#1354) will let formatters access embeddings stored in a step result. The patch on cucumber-ruby-core (cucumber/cucumber-ruby-core#170) will store in the step result the embeddings returned by the step invocation. The patch on cucumber-ruby-wire (cucumber/cucumber-ruby-wire#20) will allow the embeddings stored in the wire response to be returned by the wire-based step invocation process. The patch on cucumber-cpp (cucumber/cucumber-cpp#223) will allow C++ steps to send embeddings through wire responses.

Note: embeddings were not considered to be useful for pending steps, but support should be possible if required.

Details

This patch:

Patches on cucumber-ruby, cucumber-ruby-core, cucumber-ruby-wire have been submitted for integration in cucumber 4.x, but the changes on cucumber-cpp should be backward compatible with cucumber 2.x. Embeddings will just be ignored.

How Has This Been Tested?

Unit test on the redesign of the invokeStep() method, serialization of embeddings and creation of WireResponse from InvokeResult. Still need to look at E2E tests (suggestions welcomed).

Types of changes

Checklist:

coveralls commented 5 years ago

Coverage Status

Coverage decreased (-0.8%) to 61.69% when pulling 7e01c437cf3ca15183980246231dc3685c0735fe on Sigill:embeddings_support into dd424c1a900cb41c5db9d481714eb3471ce195e3 on cucumber:master.

jermus67 commented 2 years ago

This PR is closed without merging.

The PR was the last of sequence of four PRs, that had to be merged in a specific sequence as each PR in the series depended on the previous one having been merged before.

Since the second and third PR have been closed without merging, there is no point in merging this one. If this functionality is required first the two other PRs need to be revived before it makes sense to have another look at this one.