Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add testing utility for asserting SseEmitter events #33746

Open
bclozel opened this issue Oct 18, 2024 · 1 comment
Open

Add testing utility for asserting SseEmitter events #33746

bclozel opened this issue Oct 18, 2024 · 1 comment
Assignees
Labels
in: test Issues in the test module in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@bclozel
Copy link
Member

bclozel commented Oct 18, 2024

As seen in #33722, SseEmitter does not currently provide a way to perform assertions on published events for testing purposes. Our own testing infrastructure is leveraging protected methods to configure a test handler - we should consider providing a testing utility for this use case.

@bclozel bclozel added in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement labels Oct 18, 2024
@bclozel bclozel added this to the 7.0.x milestone Oct 18, 2024
@bclozel bclozel self-assigned this Oct 18, 2024
@rstoyanchev
Copy link
Contributor

What about using MockMvc, and then check the output stream? Not at the same level of control, but MockMvc is lightweight (no server, nor full Spring config), and tests controllers more fully. In terms of testing items as they come, one at a time, one way or the other, the controller can't stream indefinitely, and has to be notified in some way to stop streaming, which makes it feasible to aggregate and check the response.

@sbrannen sbrannen added the in: test Issues in the test module label Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: test Issues in the test module in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants