Server Sent Events testing
Server Sent Events (SSE) are quite ubiquitous nowadays but I cannot really test them with Karate when the response of a call is an SSE response.
sequenceDiagram
client->>server: GET /notifications
server-->>client: 200 OK + SSE stream payload
server-->>client: SSE stream payload
So in order to test I would need either:
- A way to create assertions of the stream (stream contains data)
- A way to wait cancel the stream and transform the capture in JSON and then perform the assertion
Isn't this your issue https://stackoverflow.com/questions/60121921/trying-to-do-assertion-on-sse-type-content-type
i asked this question few years ago and @ptrthomas responded fast as usual
unless it's something different
Well - this is partially what i need. The issue is that I want to wait for let's say 3 minutes and watch the stream for a certain event that might or might not come. Apart from matching the data I need a way to deal with the stream which is different from the request-response mechanism in Karate. Even Postman (which I hate) has SSE and websocket extensions so I really think that a way of handling streaming responses is needed in Karate also.
@vs-dsva noted. heads up that this is likely to be added as a closed-source extension to karate similar to kafka, gRPC and websocket which are already released: https://github.com/karatelabs/karate-addons