In order to let cucumber formatters access embeddings transferred in wire responses, embeddings have to be returned by the Invoke event handler.
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 3rd 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 embeddings will then be stored in the step Result in order to be accessible by the formatter.
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
In the current implementation, it's not possible to access data from the wire response as nothing is returned from the wire invocation when a step succeed (a step is considered successful by default, an exception needs to be raised in case of failing or pending step).
This patch make the request handler responsible for step invocations return a PassedInvokeResult/FailedInvokeResult object describing the step result (status, embeddings).
Those changes should be backward compatible.
How Has This Been Tested?
No test in that repository, but I just discovered there is a FakeWireServer, I need to see if I can do something with it. Suggestions are welcomed.
Types of changes
[ ] Refactor (code change that does not change external functionality)
[ ] Bug fix (non-breaking change which fixes an issue)
[x] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
Checklist:
[ ] I've added tests for my code
[ ] My change requires a change to the documentation.
Summary
In order to let cucumber formatters access embeddings transferred in wire responses, embeddings have to be returned by the Invoke event handler.
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 3rd 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.:
The embeddings will then be stored in the step Result in order to be accessible by the formatter.
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
In the current implementation, it's not possible to access data from the wire response as nothing is returned from the wire invocation when a step succeed (a step is considered successful by default, an exception needs to be raised in case of failing or pending step).
Successful step
Failing step
This patch make the request handler responsible for step invocations return a
PassedInvokeResult
/FailedInvokeResult
object describing the step result (status, embeddings).Those changes should be backward compatible.
How Has This Been Tested?
No test in that repository, but I just discovered there is a FakeWireServer, I need to see if I can do something with it. Suggestions are welcomed.
Types of changes
Checklist: