sp3-solo-1770327084/.sdlc/features/websocket-chat/qa-plan.md
rdev-worker 82c41e819b
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
build: /implement-feature websocket-chat --requirements 'GET /ws upgrades to...
2026-02-05 21:58:16 +00:00

47 lines
1.8 KiB
Markdown

# QA Plan: WebSocket Chat with Redis Pub/Sub
## Test Categories
### 1. Unit Tests
| Test | Description | Location |
|------|-------------|----------|
| Config loading | RedisURL read from environment | `config/config_test.go` |
| Hub registration | Connections register/unregister | `pkg/realtime/hub_test.go` |
| Room management | Join/leave room operations | `pkg/realtime/hub_test.go` |
| Message broadcast | Room and global broadcast | `pkg/realtime/hub_test.go` |
### 2. Integration Tests
| Test | Description | Location |
|------|-------------|----------|
| WebSocket upgrade | GET /ws returns 101 Switching Protocols | `handlers/ws_test.go` |
| Room join URL | GET /ws/{room} joins room | `handlers/ws_test.go` |
| Room join query | GET /ws?room=x joins room | `handlers/ws_test.go` |
| Message echo | Client receives own messages | `handlers/ws_test.go` |
| Multi-client broadcast | All clients receive messages | `handlers/ws_test.go` |
| Stats endpoint | GET /ws/stats returns counts | `handlers/ws_test.go` |
| Connection cleanup | Disconnected clients removed | `handlers/ws_test.go` |
### 3. Manual Tests
| Test | Steps | Expected |
|------|-------|----------|
| wscat connection | `wscat -c ws://localhost:8001/api/chat-api/ws` | Connection established |
| Send message | Send JSON `{"type":"chat","data":{"text":"hello"}}` | Message echoed back |
| Room broadcast | Two clients join same room, one sends | Both receive message |
| Stats check | `curl localhost:8001/api/chat-api/ws/stats` | Returns connection count |
## Test Environment
- Redis running via docker-compose
- Service running on port 8001
- WebSocket client: wscat or websocat
## Pass Criteria
- All unit tests pass
- All integration tests pass
- Manual WebSocket connection test successful
- Message broadcast verified with multiple clients