Test 测试插件
默认基地址:http://localhost:8180,前缀:/test
| 方法 | 路径 | 说明 |
|---|---|---|
| GET | /test/ | 当前任务列表 |
| GET | /test/integration | 集成测试任务列表 |
| GET | /test/stress | 压测任务列表 |
| GET | /test/cases | 测试用例列表 |
| GET | /test/api/cases | 测试用例列表(带统一响应) |
| GET | /test/api/stress/count | 压测推拉流数量统计 |
| POST | /test/api/cases/execute | 执行测试用例 |
| POST | /test/api/stress/push/{protocol}/{count} | 启动/调整推流压测 |
| POST | /test/api/stress/pull/{protocol}/{count} | 启动/调整拉流压测 |
| POST | /test/api/stress/stop/push | 停止推流压测 |
| POST | /test/api/stress/stop/pull | 停止拉流压测 |
| POST | /test/stop | 停止指定任务 |
逐接口详细说明
Section titled “逐接口详细说明”1) GET /test/
Section titled “1) GET /test/”返回当前任务列表。
响应字段:
| 字段 | 类型 | 说明 |
|---|---|---|
jobs | array | 任务数组 |
count | int | 任务数量 |
2) GET /test/api/stress/count
Section titled “2) GET /test/api/stress/count”返回推流/拉流压测数量统计。
响应示例:
{ "code": 0, "message": "success", "data": { "pushCount": 10, "pullCount": 20 }}3) POST /test/api/cases/execute
Section titled “3) POST /test/api/cases/execute”POST /test/api/cases/executeContent-Type: application/json{ "names": ["basic_rtmp_to_flv", "webrtc_publish"] }| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
names | string[] | 是 | 要执行的测试用例名列表 |
4) POST /test/api/stress/push/{protocol}/{count}
Section titled “4) POST /test/api/stress/push/{protocol}/{count}”POST /test/api/stress/push/rtmp/100Content-Type: application/json{ "remoteURL": "rtmp://localhost/live/stress/%d", "streamPath": "live/source"}路径参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
protocol | string | 是 | rtmp/rtsp/webrtc 等 |
count | int | 是 | 目标推流并发数 |
请求体字段:
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
remoteURL | string | 否 | 目标地址,可含 %d 占位 |
streamPath | string | 否 | 源流路径,默认 live/source |
5) POST /test/api/stress/pull/{protocol}/{count}
Section titled “5) POST /test/api/stress/pull/{protocol}/{count}”POST /test/api/stress/pull/rtmp/100Content-Type: application/json{ "remoteURL": "rtmp://localhost/live/source", "testMode": 0}请求体字段:
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
remoteURL | string | 否 | 拉流源地址,可含 %d |
testMode | int | 否 | 测试模式,默认 0 |
6) POST /test/stop
Section titled “6) POST /test/stop”{ "id": 123 }| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
id | uint64 | 是 | 任务 ID |
通用响应示例
Section titled “通用响应示例”{ "code": 0, "message": "success", "data": { "pushCount": 100, "protocol": "rtmp" }}| HTTP 状态码 | 场景 |
|---|---|
| 400 | 参数错误(如 count 非数字) |
| 404 | 路径不存在 |
| 500 | Stream manager / service registry 不可用 |
联系我们
微信公众号:不卡科技
腾讯频道:流媒体技术
QQ 频道:p0qq0crz08
QQ 群:751639168