You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Scheme handling (`ws://`, `wss://`, rejection of `http://`)
11
+
- Connection error timing (refused-connection fails fast, unroutable IP hits the library's 5s timeout)
12
+
-`onError( type="connect", ... )` listener invocation on connect failure
13
+
- OSGi loader health
14
+
15
+
Runs in the `test` job via `lucee/script-runner@main` with `testLabels: websocketclient`. Fast, no network dependencies beyond loopback.
16
+
17
+
Fixture: `RecordingListener.cfc` captures every callback with its arguments for later assertion. Use it whenever a test needs to verify a callback fired.
18
+
19
+
### Integration tests (server repo)
20
+
21
+
The real client⇄server coverage — `sendText`, `sendBinary`, `onMessage`, `onClose`, `disconnect`, `isOpen`, lifecycle event ordering — lives in the server extension repo:
Those tests use `CreateWebSocketClient` as the driver against a Lucee WebSocket server listener, so they cover both extensions end to end.
26
+
27
+
## Why not duplicate the integration tests here?
28
+
29
+
Every integration test needs both extensions running. Duplicating the suite across two repos guarantees drift. Instead:
30
+
31
+
- One copy lives in the server repo.
32
+
- The `test-integration` job in this repo's workflow **sparse-checkouts**`tests/integration/` from the server repo, builds this branch's client `.lex`, pulls the latest server `.lex` from download.lucee.org, and runs the suite against the combined pair.
33
+
- Each side's CI catches the bug on its own side — server changes fail in the server repo, client changes fail here.
34
+
35
+
## What fails where
36
+
37
+
| Bug source | Caught by |
38
+
|---|---|
39
+
| Client BIF contract (arg handling, error shape) | Unit tests in this repo |
40
+
| Client callback invocation (onError on connect fail) | Unit tests in this repo |
| Server callback firing, broadcast, state | Integration tests (server repo CI) |
43
+
44
+
## Adding a test
45
+
46
+
Needs a server to drive it? **Add it to the server repo's [`tests/integration/`](https://github.com/lucee/extension-websocket/tree/master/tests/integration).** Both CIs will pick it up.
47
+
48
+
No server needed (argument validation, error shape, scheme parsing)? **Add a `testXxx()` method to [`WebSocketClientTest.cfc`](WebSocketClientTest.cfc) here.**
49
+
50
+
## Running locally
51
+
52
+
Unit tests — whatever CFML test runner you use that picks up `labels="websocketclient"`. Or invoke `WebSocketClientTest.cfc` methods directly from a test script.
53
+
54
+
Integration tests — spin up Lucee with both extensions, drop the server listeners into `{lucee-config}/websockets/`, and `curl` the `.cfm` scripts from the server repo's `tests/integration/` folder. See [that repo's CI workflow](https://github.com/lucee/extension-websocket/blob/master/.github/workflows/main.yml) for the exact setup — it's the same one this repo's `test-integration` job uses.
0 commit comments