WebSocket Testing Task
WebSocket Testing Task
defines a WebSocket protocol testing task for functionality, performance, stability, and custom testing of WebSocket features.
Main Parameter List
Field Name | Type | Required | Length/Range | Description |
---|---|---|---|---|
target | enum | Yes | - | Task Type Identifier Fixed value: WEBSOCKET |
name | string | Yes | ≤400 chars | Task Unique Identifier Example: Real-time Stock Quotes |
description | string | No | ≤800 chars | Task Description Detailed explanation of interface functionality |
enabled | boolean | Yes | - | Enable Statustrue : Enabled (default)false : Disabled |
apisId | integer(int64) | No | - | Interface Association ID Links to AngusTester interface ID Test results will update the corresponding interface |
url | string | No | ≤2000 chars | Complete Request URL Higher priority than server+endpoint combination Example: wss://api.example.com/ws |
server | object | No | - | Server Configuration Includes protocol, host, port, etc. Combined with endpoint to form complete URL |
endpoint | string | No | ≤800 chars | Request Endpoint Combined with server to form complete URLExample: /market/data |
parameters | array[object] | No | 1-7200 items | Request Parameters Includes query parameters, path parameters, etc. Configuration reference HTTP Request Parameters |
mode | enum | Yes | - | Message Interaction ModeONLY_SEND : Send onlyONLY_RECEIVE : Receive onlySEND_AND_RECEIVE : Bidirectional interaction (default) |
message | string | No | ≤8192 chars | Message Content to Send Supports variables and Mock functions Example: {"symbol":"{stockSymbol}"} |
messageEncoding | enum | No | - | Message Encoding Formatnone : Raw text (default)base64 : Base64 encodedgzip_base64 : Gzip compressed then Base64 |
assertions | array[object] | No | - | Response Assertions Supports content, size, duration validation Configuration reference HTTP Assertions |
datasets | array[object] | No | - | Test Datasets Drives parameterized testing Supports CSV/JSON formats View Dataset Definition |
actionOnEOF | enum | No | - | Dataset End PolicyRECYCLE : Recycle (default)STOP_THREAD : Stop thread |
sharingMode | enum | No | - | Data Sharing ModeALL_THREAD : Thread-shared (default)CURRENT_THREAD : Thread-independent copy |
Note
Multiple WebSocket interfaces can be orchestrated simultaneously, but only one WebSocket can be enabled for testing at a time.
Complete WebSocket configuration example:
yaml
- target: WEBSOCKET
name: The `SEND_AND_RECEIVE` mode example
description:
"The client and server simultaneously remoting messages with each other,\
\ default Mode."
enabled: true
url: ws://localhost:8082/example/SEND_AND_RECEIVE
parameters:
# Request parameter configuration ...
mode: SEND_AND_RECEIVE
message: Hi~
messageEncoding: none
assertions:
# Assertion configuration ...
datasets:
# Dataset configuration ...
actionOnEOF: RECYCLE
sharingMode: ALL_THREAD
Message Modes (mode)
WebSocket performance testing mode scenarios:
1. ONLY_SEND (Send Only)
Performance Scenarios:
- Data Reporting Systems: Device status, sensor data continuous reporting
- Log Collection Systems: Distributed system log real-time transmission
- Monitoring Data Push: Server metrics batch push
Performance Metrics:
- Message send rate (msg/s)
- Connection concurrency
- Bandwidth utilization
2. ONLY_RECEIVE (Receive Only)
Performance Scenarios:
- Market Subscription Systems: Stock/cryptocurrency real-time quotes push
- Real-time Notification Systems: System alerts, order status change notifications
- Event Broadcast Systems: Match scores, news real-time updates
Performance Metrics:
- Message receive throughput (msg/s)
- Message latency (ms)
- Connection stability
3. SEND_AND_RECEIVE (Send and Receive)
Performance Scenarios:
- Instant Messaging: Chat application message exchange
- Device Control: Command sending and status feedback
Performance Metrics:
- End-to-end latency (ms)
- Transaction success rate (%)
- Concurrent session count
Script Examples (target)
Complete Parameter Configuration Example
yaml
- target: WEBSOCKET
name: The `SEND_AND_RECEIVE` mode example
description:
"The client and server simultaneously remoting messages with each other,\
\ default Mode."
enabled: true
url: ws://localhost:8082/example/SEND_AND_RECEIVE
parameters:
- name: access_token
in: query
description: Authentication parameters when connecting to WebSocket.
enabled: true
type: string
value: 17062ee76ea94bd28cf4eccc48a85f0e
- name: ServerMessage
in: query
description:
This is the simulated test client's expectation for the message to
be returned by the server.
enabled: true
type: string
value: Hi~ {name}
mode: SEND_AND_RECEIVE
message: Hi~
messageEncoding: none
assertions:
- name: Assert that the received content includes SUCCESS.
enabled: true
type: BODY
assertionCondition: CONTAIN
expected: SUCCESS
- name: Assert that the length of the received content does not exceed 1 KB.
enabled: true
type: SIZE
assertionCondition: LESS_THAN
expected: 1024
- name:
Assert that the time interval for receiving the latest message does not exceed
200 milliseconds.
enabled: true
type: DURATION
assertionCondition: EQUAL
expected: 200
datasets:
- name: NameDataset
parameters:
- name: name
value: '@Name()'
actionOnEOF: RECYCLE
sharingMode: ALL_THREAD
Client Only Sends Messages to Server (ONLY_SEND) Mode Example
yaml
- target: WEBSOCKET
name: The `ONLY_SEND` mode example
description: Only send custom messages to the server.
enabled: true
url: ws://localhost:8082/example/ONLY_SEND
parameters:
- name: access_token
in: query
description: Authentication parameters when connecting to WebSocket.
enabled: true
type: string
value: 17062ee76ea94bd28cf4eccc48a85f0e
mode: ONLY_SEND
message: Hi~
Client Only Receives Messages from Server (ONLY_RECEIVE) Mode Example
yaml
- target: WEBSOCKET
name: The `ONLY_RECEIVE` mode example
description: Only receiving messages from the server and asserting them.
enabled: true
url: ws://localhost:8082/example/ONLY_RECEIVE
parameters:
- name: access_token
in: query
description: Authentication parameters when connecting to WebSocket.
enabled: true
type: string
value: 17062ee76ea94bd28cf4eccc48a85f0e
- name: ServerMessage
in: query
description: This is the simulated test client's expectation for the message to be returned by the server.
enabled: true
type: string
value: This is a `SUCCESS` message returned by the server.
- name: ServerDelay
in: query
description: This is the simulated test client's expectation for the delay(milliseconds) in the message returned by the server.
enabled: true
type: string
value: 20-200
mode: ONLY_RECEIVE
assertions:
- name: Assert that the received content includes SUCCESS.
enabled: true
type: BODY
expected: SUCCESS
assertionCondition: CONTAIN
- name: Assert that the length of the received content does not exceed 1 KB.
enabled: true
type: SIZE
expected: 1024
assertionCondition: LESS_THAN
- name:
Assert that the time interval for receiving the latest message does not
exceed 200 milliseconds.
enabled: true
type: DURATION
expected: 200
assertionCondition: LESS_THAN
Client Sends and Receives Messages (SEND_AND_RECEIVE) Mode Example
yaml
- target: WEBSOCKET
name: The `SEND_AND_RECEIVE` mode example
description: The client and server simultaneously remoting messages with each other, default Mode.
enabled: true
url: ws://localhost:8082/example/SEND_AND_RECEIVE
parameters:
- name: access_token
in: query
description: Authentication parameters when connecting to WebSocket.
enabled: true
type: string
value: 17062ee76ea94bd28cf4eccc48a85f0e
- name: ServerMessage
in: query
description: This is the simulated test client's expectation for the message to be returned by the server.
enabled: true
type: string
value: Hi~
mode: SEND_AND_RECEIVE
message: Hi~
assertions:
- name: Assert that the received content includes SUCCESS.
enabled: true
type: BODY
expected: Hi~
assertionCondition: EQUAL