uip tm 性能场景
“uip tmperf-scenario”的语法和选项,可创建和运行 Test Manager 性能场景,检查执行数据并生成报告。
uip tm perf-scenario 用于管理 Test Manager 性能场景:创建场景,将测试用例作为具有负载配置文件(虚拟用户、加速/峰值/减速时间、SLO 阈值)的负载组绑定到该场景,将其作为快速干项目运行或完整负载测试,然后检查生成的执行数据并呈现报告。
此页面记录了一个完全交付的真实命令组 — 它与其他所有 uip tm 命令一起无条件注册,而不是在功能标志后面注册。如果您被告知此界面不存在或为预发布版本,请直接使用 uip tm perf-scenario --help 进行验证。
此资源分为四个页面:
- 本页— 概念和场景生命周期:
create、get、list、execute、stop、list-dry-run-reports。 - 加载组—
load-groups add/update/remove/list,测试用例到场景的绑定及其加载配置文件。 - 执行数据—
executions list、results get、http-errors list、automation-errors list、transaction-metrics list。 - 报告—
report generate、report compare。
概念
- 场景— 顶级性能测试定义(例如
--scenario-keySP1:7。使用create创建,使用get检查,使用execute运行。 - 负载组— 将一个测试用例绑定到具有负载配置文件(虚拟用户、时间、SLO 阈值、机器人类型)的场景。一个场景可以拥有多个负载组。请参阅负载组。
- 执行— 运行一次场景,可以是
dryRun(快速冒烟运行)或performanceTesting(遵循每个负载组的负载配置文件的完整负载运行)。从execute开始,通过执行数据进行检查,并通过stop提前停止。 - 空运行报告— 性能服务在通过空运行后记录报告。运行完整的
performanceTesting至少需要一份通过空运行报告;在运行完整负载测试之前,请确认list-dry-run-reports。
这四个页面中的大多数读取动词都接受 --query <expr>,这是一种在打印输出 Data 之前在客户端应用于客户端的 jq 样式筛选器 — 使用它来缩小大型有效负载的范围(请参阅下面的 list 示例)。
大纲
uip tm perf-scenario create --project-key <key> --name <name> [--description <text>] [--version <version>] [--app-type <type>] [--perf-test-type <type>] [--responsiveness <level>]
uip tm perf-scenario get --scenario-key <key> [--project-key <key>]
uip tm perf-scenario list --project-key <key> [--search <text>] [--limit <n>] [--offset <n>] [--query <expr>]
uip tm perf-scenario execute --scenario-key <key> [--project-key <key>] [--execution-type <dryRun|performanceTesting>] [--wait [--full] [--poll-interval-sec <n>] [--timeout-sec <n>]]
uip tm perf-scenario stop --execution-id <uuid> --project-key <key>
uip tm perf-scenario list-dry-run-reports --scenario-key <key> [--project-key <key>]
uip tm perf-scenario create --project-key <key> --name <name> [--description <text>] [--version <version>] [--app-type <type>] [--perf-test-type <type>] [--responsiveness <level>]
uip tm perf-scenario get --scenario-key <key> [--project-key <key>]
uip tm perf-scenario list --project-key <key> [--search <text>] [--limit <n>] [--offset <n>] [--query <expr>]
uip tm perf-scenario execute --scenario-key <key> [--project-key <key>] [--execution-type <dryRun|performanceTesting>] [--wait [--full] [--poll-interval-sec <n>] [--timeout-sec <n>]]
uip tm perf-scenario stop --execution-id <uuid> --project-key <key>
uip tm perf-scenario list-dry-run-reports --scenario-key <key> [--project-key <key>]
--project-key仅是此页面create和stop上的.requiredOption() (以及load-groups update / remove — list参阅加载组)。在 get、execute 和 list-dry-run-reports 上,这是可选的 — 若省略 --scenario-key 的前缀,则项目将派生(例如 SP1:7 → 项目 SP1),并且 --project-key 会覆盖该派生如果通过。“执行数据”和“报告”页面上的动词根本不接受--project-key (两个report动词除外,这仅影响返回的链接是否打开应用程序内报告页面)— 这些动词调用直接运行 Performance Service,而不是解析 Test Manager 项目。
uip tm 性能场景创建
在 Test Manager 项目中创建一个性能场景。
选项
| 标记 | 描述 |
|---|---|
--project-key <key> | 必需。拥有的项目。 |
--name <name> | 必需。场景名称。 |
--description <text> | 场景描述。默认为空。上限为 5120 个字符。 |
--version <version> | 场景版本字符串。默认为 1.0。上限为 255 个字符。 |
--app-type <type> | 应用程序类型:web、apiService、ecommerce、gaming、financial、healthcare、saaS、streaming、messaging、enterprise。默认为 web。 |
--perf-test-type <type> | 性能测试类型:loadTesting、stressTesting、enduranceTesting、spikeTesting。默认为 loadTesting。 |
--responsiveness <level> | 预期响应速度:instant、fast、moderate、slow、verySlow。默认为 fast。 |
示例
uip tm perf-scenario create \
--project-key SP1 \
--name "Checkout load" \
--app-type web \
--perf-test-type loadTesting \
--responsiveness fast
uip tm perf-scenario create \
--project-key SP1 \
--name "Checkout load" \
--app-type web \
--perf-test-type loadTesting \
--responsiveness fast
数据形状
{
"Code": "ScenarioCreate",
"Data": {
"ScenarioKey": "SP1:7",
"Name": "Checkout load",
"Version": "1.0",
"AppType": "web",
"PerfTestType": "loadTesting",
"Responsiveness": "fast"
}
}
{
"Code": "ScenarioCreate",
"Data": {
"ScenarioKey": "SP1:7",
"Name": "Checkout load",
"Version": "1.0",
"AppType": "web",
"PerfTestType": "loadTesting",
"Responsiveness": "fast"
}
}
uip tm 性能场景获取
获取场景的元数据以及绑定到元数据的负载组。
选项
| 标记 | 描述 |
|---|---|
--scenario-key <key> | 必需。场景对象键(例如 SP1:7)。 |
--project-key <key> | 拥有的项目。可选 — 若省略 --scenario-key 前缀,则派生自该前缀。 |
示例
uip tm perf-scenario get --scenario-key SP1:7
uip tm perf-scenario get --scenario-key SP1:7
数据形状
{
"Code": "ScenarioGet",
"Data": {
"ScenarioKey": "SP1:7",
"Name": "Checkout load",
"Version": "1.0",
"Description": "",
"AppType": "web",
"PerfTestType": "loadTesting",
"Responsiveness": "fast",
"LoadGroups": [
{
"LoadGroupId": "8e322581-0a25-0000-738b-0b49fd936ca1",
"TestCaseKey": "SP1:602",
"Name": "Checkout flow",
"PackageName": "Checkout_Tests",
"PackageVersion": "1.0.2",
"FolderKey": "94821c49-ab85-49cb-94e1-f82c6d8973be",
"VirtualUsers": 20,
"Enabled": true
}
]
}
}
{
"Code": "ScenarioGet",
"Data": {
"ScenarioKey": "SP1:7",
"Name": "Checkout load",
"Version": "1.0",
"Description": "",
"AppType": "web",
"PerfTestType": "loadTesting",
"Responsiveness": "fast",
"LoadGroups": [
{
"LoadGroupId": "8e322581-0a25-0000-738b-0b49fd936ca1",
"TestCaseKey": "SP1:602",
"Name": "Checkout flow",
"PackageName": "Checkout_Tests",
"PackageVersion": "1.0.2",
"FolderKey": "94821c49-ab85-49cb-94e1-f82c6d8973be",
"VirtualUsers": 20,
"Enabled": true
}
]
}
}
此处的LoadGroupId是场景的负载组 ID — 标识符load-groups update和load-groups remove除外(请参阅负载组)。这与 load-groups list 返回的每次执行的行的 ID 不同。
uip tm 性能场景列表
列出项目中的性能场景。
选项
| 标记 | 描述 |
|---|---|
--project-key <key> | 必需。拥有的项目。 |
--search <text> | 按名称或键筛选场景。 |
--limit <n> | 可返回的最大结果数量。省略时,默认为服务自己的页面大小。 |
--offset <n> | 要跳过的结果以进行分页。默认为 0。 |
--query <expr> | 应用于输出数据的 jq 样式筛选器。 |
示例
uip tm perf-scenario list --project-key DEMO
uip tm perf-scenario list --project-key DEMO
# search by name, narrowing the output to just the scenario rows
uip tm perf-scenario list --project-key DEMO --search checkout --query .Scenarios
# search by name, narrowing the output to just the scenario rows
uip tm perf-scenario list --project-key DEMO --search checkout --query .Scenarios
数据形状
{
"Code": "PerfScenariosList",
"Data": {
"Total": 2,
"Count": 2,
"Scenarios": [
{
"ScenarioKey": "DEMO:7",
"Name": "Checkout load",
"Version": "1.0",
"AppType": "web",
"PerfTestType": "loadTesting",
"Responsiveness": "fast",
"VirtualUsers": 20,
"DurationMinutes": 0,
"Updated": "2025-04-15T10:30:00Z",
"UpdatedBy": "alice@example.com"
},
{
"ScenarioKey": "DEMO:9",
"Name": "Search stress",
"Version": "1.0",
"AppType": "web",
"PerfTestType": "stressTesting",
"Responsiveness": "fast",
"VirtualUsers": 100,
"DurationMinutes": 0,
"Updated": "2025-04-15T10:30:00Z",
"UpdatedBy": "alice@example.com"
}
]
}
}
{
"Code": "PerfScenariosList",
"Data": {
"Total": 2,
"Count": 2,
"Scenarios": [
{
"ScenarioKey": "DEMO:7",
"Name": "Checkout load",
"Version": "1.0",
"AppType": "web",
"PerfTestType": "loadTesting",
"Responsiveness": "fast",
"VirtualUsers": 20,
"DurationMinutes": 0,
"Updated": "2025-04-15T10:30:00Z",
"UpdatedBy": "alice@example.com"
},
{
"ScenarioKey": "DEMO:9",
"Name": "Search stress",
"Version": "1.0",
"AppType": "web",
"PerfTestType": "stressTesting",
"Responsiveness": "fast",
"VirtualUsers": 100,
"DurationMinutes": 0,
"Updated": "2025-04-15T10:30:00Z",
"UpdatedBy": "alice@example.com"
}
]
}
}
Total 是服务器报告的匹配项总数,当 Count 截断页面时,该计数可能会超过 --limit(实际返回的行数)。
uip tm 性能场景执行
执行场景并返回其执行 ID。默认模式为 dryRun(快速烟雾运行);对于完整负载运行,请传递 --execution-type performanceTesting,并遵循每个负载组上的负载配置文件标志。完整运行至少需要一份通过的空运行报告 — 请先检查 list-dry-run-reports。
选项
| 标记 | 描述 |
|---|---|
--scenario-key <key> | 必需。场景对象键(例如 SP1:7)。 |
--project-key <key> | 拥有的项目。可选 — 若省略 --scenario-key 前缀,则派生自该前缀。 |
--execution-type <type> | dryRun 或 performanceTesting。 默认值为 dryRun。 |
--wait | 轮询,直到运行达到终止状态( Finished或Cancelled ),然后发出与results get相同的形状(请参阅执行数据)。如果运行为 Cancelled、自动化配置失败或违反 SLO,则以非零值退出。 |
--full | 使用 --wait,在输出中包括每秒时间序列 (AggregatedData + AggregatedDataWithTransaction)。如果在没有 --wait 的情况下通过,则会出现错误。 |
--poll-interval-sec <n> | 若使用 --wait,则状态检查间隔时间为秒。默认为 12。如果在没有 --wait 的情况下通过,则会出现错误。 |
--timeout-sec <n> | 对于 --wait,等待的最大秒数(0 = 不超时)。默认为 1800。如果在没有 --wait 的情况下通过,则会出现错误。已消耗退出 4 — 运行将继续,请使用 results get 重新检查。 |
示例
# start a dry run and return immediately
uip tm perf-scenario execute --scenario-key SP1:7
# start a dry run and return immediately
uip tm perf-scenario execute --scenario-key SP1:7
# run a full performance test and wait for the results bundle
uip tm perf-scenario execute \
--scenario-key SP1:7 \
--execution-type performanceTesting \
--wait
# run a full performance test and wait for the results bundle
uip tm perf-scenario execute \
--scenario-key SP1:7 \
--execution-type performanceTesting \
--wait
数据形状 — 无 --wait
{
"Code": "ScenarioExecute",
"Data": {
"ScenarioKey": "SP1:7",
"ExecutionId": "80694766-5a44-0000-0985-0b49fd93832d",
"ExecutionType": "dryRun",
"Status": "Pending"
}
}
{
"Code": "ScenarioExecute",
"Data": {
"ScenarioKey": "SP1:7",
"ExecutionId": "80694766-5a44-0000-0985-0b49fd93832d",
"ExecutionType": "dryRun",
"Status": "Pending"
}
}
数据形状 — with --wait
{
"Code": "ScenarioExecutionResults",
"Data": {
"ExecutionId": "80694766-5a44-0000-0985-0b49fd93832d",
"LoadGroupCount": 1,
"LoadGroups": [
{
"LoadGroupId": "8e322581-0a25-0000-738b-0b49fd936ca1",
"StartedAt": "2025-04-15T10:30:00Z",
"CumulativeResponseTimeMs": 120,
"MaxResponseTimeMs": 450,
"SuccessfulWorkflowCount": 98,
"FailedWorkflowCount": 2,
"HttpErrorCount": 0,
"HttpErrorRate": 0,
"AutomationErrorCount": 2,
"AutomationErrorRate": 0.02,
"SloViolationReasons": []
}
],
"LogCount": 12,
"ApplicationLogs": [
{
"CreatedAt": "2025-04-15T10:31:00Z",
"LogLevel": "Information",
"ExecutionId": "80694766-5a44-0000-0985-0b49fd93832d",
"Message": "Execution finished"
}
]
}
}
{
"Code": "ScenarioExecutionResults",
"Data": {
"ExecutionId": "80694766-5a44-0000-0985-0b49fd93832d",
"LoadGroupCount": 1,
"LoadGroups": [
{
"LoadGroupId": "8e322581-0a25-0000-738b-0b49fd936ca1",
"StartedAt": "2025-04-15T10:30:00Z",
"CumulativeResponseTimeMs": 120,
"MaxResponseTimeMs": 450,
"SuccessfulWorkflowCount": 98,
"FailedWorkflowCount": 2,
"HttpErrorCount": 0,
"HttpErrorRate": 0,
"AutomationErrorCount": 2,
"AutomationErrorRate": 0.02,
"SloViolationReasons": []
}
],
"LogCount": 12,
"ApplicationLogs": [
{
"CreatedAt": "2025-04-15T10:31:00Z",
"LogLevel": "Information",
"ExecutionId": "80694766-5a44-0000-0985-0b49fd93832d",
"Message": "Execution finished"
}
]
}
}
--wait 在内部轮询 results get,因此这与 results get 为已完成的运行返回的有效负载形式相同 — execute --wait 仅保存第二个命令。任何负载组上的非空 SloViolationReasons 数组或匹配“配置执行已以‘失败’状态结束”的应用程序日志,会使命令退出非零,即使运行达到最终状态也是如此。
uip tm 性能场景停止
取消正在运行的场景执行。
选项
| 标记 | 描述 |
|---|---|
--execution-id <uuid> | 必需。场景执行 UUID(来自 ExecutionId 的 execute)。 |
--project-key <key> | 必需。拥有的项目。 |
示例
uip tm perf-scenario stop --execution-id 80694766-5a44-0000-0985-0b49fd93832d --project-key SP1
uip tm perf-scenario stop --execution-id 80694766-5a44-0000-0985-0b49fd93832d --project-key SP1
数据形状
{
"Code": "ScenarioStop",
"Data": {
"ExecutionId": "80694766-5a44-0000-0985-0b49fd93832d",
"Result": "Stopping",
"Note": "Server has accepted the cancel request. Run 'perf-scenario results get --execution-id <ID>' to confirm terminal status (will be 'Cancelled')."
}
}
{
"Code": "ScenarioStop",
"Data": {
"ExecutionId": "80694766-5a44-0000-0985-0b49fd93832d",
"Result": "Stopping",
"Note": "Server has accepted the cancel request. Run 'perf-scenario results get --execution-id <ID>' to confirm terminal status (will be 'Cancelled')."
}
}
Result: "Stopping" 反映服务器已接受取消请求,而非执行实际上已停止 — 取消是异步进行的。
uip tm 性能场景列表空运行报告
列出场景成功的空运行报告。在提交完整的performanceTesting运行之前运行此命令 — 完整运行需要每个负载组自动化都有通过的空运行报告。
选项
| 标记 | 描述 |
|---|---|
--scenario-key <key> | 必需。场景对象键(例如 SP1:7)。 |
--project-key <key> | 拥有的项目。可选 — 若省略 --scenario-key 前缀,则派生自该前缀。 |
示例
uip tm perf-scenario list-dry-run-reports --scenario-key SP1:7
uip tm perf-scenario list-dry-run-reports --scenario-key SP1:7
数据形状
{
"Code": "ScenarioDryRunReports",
"Data": {
"ScenarioKey": "SP1:7",
"ScenarioId": "756e8ebf-c227-0000-8a9f-0b49fd934bef",
"HasPassingDryRun": true,
"ReportCount": 1,
"Reports": [
{
"AutomationId": "auto-1",
"RuntimeType": 4,
"RecommendedMultiplexingFactor": 3,
"ApplicationType": null
}
]
}
}
{
"Code": "ScenarioDryRunReports",
"Data": {
"ScenarioKey": "SP1:7",
"ScenarioId": "756e8ebf-c227-0000-8a9f-0b49fd934bef",
"HasPassingDryRun": true,
"ReportCount": 1,
"Reports": [
{
"AutomationId": "auto-1",
"RuntimeType": 4,
"RecommendedMultiplexingFactor": 3,
"ApplicationType": null
}
]
}
}
空的 Reports 数组(和 HasPassingDryRun: false)意味着尚无通过空运行的负载组 — 先运行 execute(默认 dryRun 模式)。如果场景没有负载组,或其所有负载组的测试用例都不包含链接的自动化,则此命令会出错,而不是返回空结果。
相关内容
- 负载组— 将测试用例绑定到场景,并调整其负载配置文件。
- 执行数据— 检查已完成或正在进行的执行。
- 报告— 呈现创作报告,以供执行或比较。
- 测试用例—
link-automation为测试用例提供automationId和load-groups add所依赖的list-dry-run-reports。 - project — 拥有每个场景的作用域。