-
Notifications
You must be signed in to change notification settings - Fork 100
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
Expose Test Server #46
Comments
Hmm, so there's nothing "fake" about the server. It's a full blown Plug/Cowboy server that I start an instance of before each test that starts at a random port in the 50k-63k range. If the port is in use then I go to the next port. https://github.com/Azolo/websockex/blob/master/test/support/test_server.ex I could extract the root of that out into a Bare WebSocket Server, but it may be easier just to write up something on how to do it yourself. Let me think on it. |
Also, incase you were wondering, the overhead of starting a actual server is almost nothing. The WebSockex test suite run in like 4 seconds, and if I were to take the WebSocket properly closing to spec tests out it would probably be more like < 1 second. |
👍 I'm actually much more comfortable spinning up a real server rather than mocking it out as well. An example of how to test something that uses WebSockex would probably be useful for people though. At least it would be for me 😄 . |
Would it be possible to Thank you so much for the awesome library |
I'd like to write unit tests around my web socket message handling and I haven't been able to think of a good way to assert on the response my code sends back to the socket. It looks like in the tests for websockex you implement a fake server and connect a client to it to test things. Could you expose that server so that consumers of their library can make use of it as well?
I'm also open to other suggestions as well if anyone has other ideas.
The text was updated successfully, but these errors were encountered: