mockito icon indicating copy to clipboard operation
mockito copied to clipboard

WebSocket support

Open cpick opened this issue 6 years ago • 6 comments

I've been using Mockito to test my RESTy client code and I've recently started using some WebSocket endpoints as well.

Is there any interest in/has there been any thought about adding WebSocket mocking to Mockito?

If there is interest, I may be able to spend some time on it.

cpick avatar Jun 07 '18 09:06 cpick

hi @cpick

I think this crate could include websocket support as long as it doesn't complicate things. the http_muncher crate that I use to parse http has some websocket support afaik (it's based on the node http parser).

PRs are welcome :cake:

lipanski avatar Jun 08 '18 22:06 lipanski

I need this as well, but before I get into it implementing it - how open is the project to a dependency on http and maybe websocket? I ask because that would change the center of gravity on this project from: a 'nothing up your sleeves' barebone http server plus test harness, to: just a test harness. That would be bad for a learning project, but good for a production crate. Is that ok with you @lipanski? I'd be happy to give it a go, so long as I can avoid dragging in futures.

sterlingjensen avatar Nov 19 '18 00:11 sterlingjensen

@sterlingjensen is there any way to allow mocking websockets without pulling in big dependencies? I'd prefer that, even if writing websocket tests would be a bit more verbose than without the extra dependencies. websockets are not such a common test scenario so I'd rather not have everyone depend on additional crates because of that (or at least not on big crates).

lipanski avatar Nov 27 '18 20:11 lipanski

@lipanski not without writing a websocket server and client. I've been working on a greenfield implementation, because you're right - it wouldn't make sense to pull in a dependency that reimplements so much existing functionality.

sterlingjensen avatar Nov 27 '18 23:11 sterlingjensen

I would also need support for websockets :/ Websockets are becoming more and more common..

@lipanski I think it's fine as long as the websocket support is put under a feature flag ? So that you don't pull in all dependencies if you want to mock just http requests.

vasilakisfil avatar Mar 10 '20 09:03 vasilakisfil

Any libraries that can be used while this get implemented in mockito?

ghost avatar Jun 24 '20 15:06 ghost