Search GimmeJob

Type at least 2 characters. Enter also searches by meaning.
QA interview question
Web, API & dataSeniorCommonTest design

How would you test a WebSocket API end to end?

Answer

Start with the connection path: endpoint, TLS, handshake, Origin, authentication and subprotocol negotiation. Then test every message type for schema, required fields, boundaries, malformed payloads, text/binary handling, acknowledgement and correct recipient or room. Add ordering, duplicate, concurrent-client and fan-out scenarios. Exercise graceful and abrupt disconnects, reconnect, restored subscriptions, missed-message behavior, heartbeat and close codes. Finally test authorization per message, rate and size limits, slow consumers, many concurrent connections, reconnect storms and observability through connection/message correlation IDs.

Strong answer includes

  • handshake plus message-contract coverage
  • disconnect/reconnect/heartbeat and close-code scenarios
  • concurrency, security, performance and observability

Practical example

For a private chat, connect two authorized users and one unrelated user. Verify ordering and acknowledgements between the first two, block the third user from subscribing to the private room, then restart the server and verify that reconnect restores the intended subscription without duplicating messages.

#websocket#api-testing#real-time#concurrency

Sources

MDN HTTP referenceMozilla · HTTP methods, messages, status codes, headers, cookies and cachingAsyncAPI Specification 3.0.0AsyncAPI Initiative · Message-driven API channels, operations, messages, schemas and bindingsDOU — QA interview: 250+ questionsDOU · Coverage signal across Junior, Middle, Senior, AQA, web, mobile and practical topics