Plan tests for a WebSocket feature
Plans tests for a real-time WebSocket feature you own, covering connection, messages, reconnects and load, with a fake client.
Task:
Plan how I test the WebSocket feature of my app, in the order I should build the tests.
Context:
The feature is [feature, such as chat or live prices] built with [stack]. The server and the client are mine. About [number of users] users are connected at peak, and messages look like [message example].
Rules:
- Cover the connection and authentication, message order and delivery, malformed messages, disconnects and automatic reconnects, and many connections at once.
- Say how to test the server with a scripted client and the browser side with a controlled fake server.
- Suggest a way to check that a reconnect does not lose or duplicate messages.
- Run any load only against my own test environment and start with small numbers.
- Keep tool names generic unless I give one, and note where timing makes a test flaky and how to reduce it.
Result:
A numbered plan of at most 7 tests, each with what it proves and how to know it passed, then one sentence on the test most likely to be flaky.