Make it easy to write WebSocket tests with MockWebServer
See original GitHub issueI noticed there are some very useful classes to allow testing web sockets code with MockWebServer in okhttp3.internal.ws.*
, such as WebSocketRecorder
.
It would be nice if these were public (along with anything else needed) so that OkHttp users can easily test their web sockets code with MockWebServer.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:15
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Using Okhttp.MockebServer for testing websocket
I am using okhttp.MockWebServer to test rest api calls. Is there a way to use it for mocking a websocket call as well?...
Read more >How to work with WebSockets and unit-test them by OkHttp ...
How to work with WebSockets and unit-test them by OkHttp and Mockito ... I'll try to write an article on how to do...
Read more >JavaScript testing #14. Mocking WebSockets using the mock ...
We create a simple application that uses WebSockets. We also write tests that ensure that our React code works correctly.
Read more >Testing REST APIs Using MockWebServer
Learn how to mock a REST API with MockWebServer and easily test your ... How to write UI tests to make sure your...
Read more >okhttp-tests/src/test/java/com/squareup/okhttp/internal/ws ...
Unless required by applicable law or agreed to in writing, software ... Test;. import static com.squareup.okhttp.internal.ws.WebSocket.PayloadType.TEXT;.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For our own needs we have created a small wrapper around MockWebServer: https://github.com/fabric8io/mockwebserver. This wrapper actually provides a DSL and it does make it easy to work with websockets:
For example:
Anyone has working example for WebSocket testing with
mockwebserver
?