alibabacloud-pts-ops

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Alibaba Cloud PTS Stress Testing Scenario Management

阿里云PTS压测场景管理

This skill enables you to create and manage stress testing scenarios using Alibaba Cloud PTS (Performance Testing Service). It supports both PTS native HTTP/HTTPS stress testing and JMeter-based stress testing.
本技能支持您使用阿里云PTS(性能测试服务)创建和管理压测场景,同时支持PTS原生HTTP/HTTPS压测和基于JMeter的压测。

Scenario Description

场景说明

PTS (Performance Testing Service) is Alibaba Cloud's fully managed performance testing platform that helps you validate the performance, capacity, and stability of your applications. This skill covers:
  1. PTS Native Stress Testing - Create HTTP/HTTPS stress testing scenarios with configurable APIs, serial links, and load models
  2. JMeter Stress Testing - Upload and run JMeter scripts with distributed load generation
PTS(性能测试服务)是阿里云的全托管性能测试平台,可帮助您验证应用的性能、容量和稳定性。本技能覆盖:
  1. PTS原生压测 - 创建HTTP/HTTPS压测场景,支持可配置的API、串行链路和负载模型
  2. JMeter压测 - 上传并运行JMeter脚本,支持分布式负载生成

Architecture

架构

User → Aliyun CLI → PTS Service → Target Application
                   Stress Testing Report
User → Aliyun CLI → PTS Service → Target Application
                   Stress Testing Report

Pre-check

预检查

Pre-check: Aliyun CLI >= 3.3.1 required Run
aliyun version
to verify >= 3.3.1. If not installed or version too low, see references/cli-installation-guide.md for installation instructions. Then [MUST] run
aliyun configure set --auto-plugin-install true
to enable automatic plugin installation.
bash
undefined
预检查:要求Aliyun CLI版本 >= 3.3.1 运行
aliyun version
确认版本不低于3.3.1。如果未安装或版本过低,请参考 references/cli-installation-guide.md 完成安装。 之后**[必须]** 运行
aliyun configure set --auto-plugin-install true
开启自动插件安装功能。
bash
undefined

Verify CLI version

验证CLI版本

aliyun version
aliyun version

Enable auto plugin installation

开启自动插件安装

aliyun configure set --auto-plugin-install true
undefined
aliyun configure set --auto-plugin-install true
undefined

Timeout Settings

超时设置

All CLI commands should include timeout parameters to avoid hanging:
bash
undefined
所有CLI命令都需要携带超时参数避免挂起:
bash
undefined

Recommended timeout settings for PTS operations

PTS操作推荐的超时设置

--read-timeout 60 --connect-timeout 10

- **read-timeout**: 60 seconds (stress testing operations may take longer)
- **connect-timeout**: 10 seconds
--read-timeout 60 --connect-timeout 10

- **read-timeout**:60秒(压测操作耗时可能较长)
- **connect-timeout**:10秒

Environment Variables

环境变量

No additional environment variables required beyond CLI authentication.
除CLI鉴权外无需额外环境变量。

Parameter Confirmation

参数确认

IMPORTANT: Parameter Confirmation — Before executing any command or API call, ALL user-customizable parameters (e.g., RegionId, scene names, target URLs, concurrency, duration, JMX files, etc.) MUST be confirmed with the user. Do NOT assume or use default values without explicit user approval.
重要提示:参数确认 — 执行任何命令或API调用前,所有用户可自定义参数(例如RegionId、场景名称、目标URL、并发数、时长、JMX文件等)必须与用户确认。未获得用户明确批准前,请勿假设或使用默认值。

User-Customizable Parameters

用户可自定义参数

Parameter NameRequiredDescriptionDefault Value
RegionIdNoRegion for PTS servicecn-hangzhou
Scene NameYesName of the stress testing scenario-
Target URLYesURL to stress test-
HTTP MethodYesGET, POST, PUT, DELETE, etc.GET
ConcurrencyYesNumber of concurrent users-
DurationYesTest duration in seconds-
JMX FileYes (JMeter)Path to JMeter script file-
ModeNoCONCURRENCY or TPSCONCURRENCY
参数名称必填说明默认值
RegionIdPTS服务所属地域cn-hangzhou
Scene Name压测场景名称-
Target URL压测目标URL-
HTTP MethodGET、POST、PUT、DELETE等GET
Concurrency并发用户数-
Duration测试时长,单位秒-
JMX FileJMeter场景必填JMeter脚本文件路径-
ModeCONCURRENCY或TPSCONCURRENCY

Authentication

鉴权

This skill relies on the Aliyun CLI's default credential chain. Ensure your CLI is already authenticated before use.
Verify current authentication:
bash
aliyun configure get
If CLI is not yet configured, see references/cli-installation-guide.md for setup instructions.
本技能依赖Aliyun CLI的默认凭证链,使用前请确保您的CLI已完成鉴权。
验证当前鉴权状态:
bash
aliyun configure get
如果CLI尚未配置,请参考 references/cli-installation-guide.md 完成设置。

RAM Policy

RAM策略

Users must have appropriate PTS permissions. See references/ram-policies.md for detailed policies.
用户需要拥有对应的PTS权限,详细策略请参考 references/ram-policies.md

Idempotency

幂等性

PTS APIs do not support
ClientToken
-based idempotency. Scene names are not unique — multiple PTS or JMeter scenarios may share the same
SceneName
. Never treat “same name” as one resource; always use
SceneId
(returned by the API) as the stable identifier.
To prevent duplicate resources or unintended side-effects when retrying after timeouts or errors, always use the check-then-act pattern before every write operation:
OperationCheck Before ActingIf Already Exists / Running
Create PTS scene (
save-pts-scene
)
Do not dedupe by name. After success, record
SceneId
.
If the prior call outcome is unknown, use
list-pts-scene
with the user to disambiguate before retrying; do not blindly retry save (each retry may create another scene).
Create JMeter scene (
save-open-jmeter-scene
)
Same as PTS — names may duplicate; use
SceneId
only.
Same pattern with
list-open-jmeter-scenes
+ user disambiguation before retry.
Start PTS test (
start-pts-scene
)
get-pts-scene-running-status
— check status
If
RUNNING
or
SYNCING
, skip; do NOT start again
Start JMeter test (
start-testing-jmeter-scene
)
get-open-jmeter-scene
— check status
If already running, skip; do NOT start again
Delete PTS scene (
delete-pts-scene
)
Confirm target
SceneId
still exists (e.g.
list-pts-scene
/
get-pts-scene
)
If that
SceneId
is gone, treat as success (already deleted)
Delete JMeter scene (
remove-open-jmeter-scene
)
Confirm target
SceneId
still exists
If that
SceneId
is gone, treat as success (already deleted)
PTS API不支持基于
ClientToken
的幂等性。场景名称不唯一 — 多个PTS或JMeter场景可以使用相同的
SceneName
。请勿将“同名”视为同一个资源,始终使用API返回的**
SceneId
**作为稳定标识符。
为避免超时或错误后重试时产生重复资源或非预期副作用,每次写操作前必须使用「先检查后执行」模式:
操作执行前检查已存在/运行中处理逻辑
创建PTS场景 (
save-pts-scene
)
不要按名称去重,创建成功后记录
SceneId
如果之前调用的结果未知,重试前先调用
list-pts-scene
并与用户共同确认目标
SceneId
;不要盲目重试(每次重试都可能创建新的场景)
创建JMeter场景 (
save-open-jmeter-scene
)
和PTS场景一致 — 名称可能重复,仅使用
SceneId
作为标识
重试前使用
list-open-jmeter-scenes
+用户确认的模式,逻辑同上
启动PTS测试 (
start-pts-scene
)
调用
get-pts-scene-running-status
检查状态
如果状态为
RUNNING
SYNCING
,跳过执行,不要重复启动
启动JMeter测试 (
start-testing-jmeter-scene
)
调用
get-open-jmeter-scene
检查状态
如果已在运行,跳过执行,不要重复启动
删除PTS场景 (
delete-pts-scene
)
确认目标**
SceneId
**仍存在(例如调用
list-pts-scene
/
get-pts-scene
如果
SceneId
不存在,视为已删除,操作成功
删除JMeter场景 (
remove-open-jmeter-scene
)
确认目标**
SceneId
**仍存在
如果
SceneId
不存在,视为已删除,操作成功

Core Workflow

核心工作流

IMPORTANT: Parameter Confirmation — Before executing any command or API call, ALL user-customizable parameters (e.g., RegionId, scene names, target URLs, concurrency, duration, etc.) MUST be confirmed with the user. Do NOT assume or use default values without explicit user approval.
重要提示:参数确认 — 执行任何命令或API调用前,所有用户可自定义参数(例如RegionId、场景名称、目标URL、并发数、时长等)必须与用户确认。未获得用户明确批准前,请勿假设或使用默认值。

Workflow 1: Create and Run PTS Native Stress Testing

工作流1:创建并运行PTS原生压测

Task 1.1: Create PTS Scenario

任务1.1:创建PTS场景

Note: Use
save-pts-scene
instead of
create-pts-scene
. The
--scene
parameter accepts a JSON object directly (not wrapped in a
Scene
field).
Idempotency:
SceneName
may duplicate across scenarios. Do not skip creation or pick a scene based on name alone. After
save-pts-scene
succeeds, record the returned
SceneId
for all later steps. If the command fails or times out with unknown outcome, use
list-pts-scene
together with the user to identify the intended
SceneId
before retrying — avoid blind retries that create extra scenes.
bash
aliyun pts save-pts-scene \
  --scene '{
    "SceneName": "<SCENE_NAME>",
    "RelationList": [
      {
        "RelationName": "serial-link-1",
        "ApiList": [
          {
            "ApiName": "api-1",
            "Url": "<TARGET_URL>",
            "Method": "<HTTP_METHOD>",
            "TimeoutInSecond": 10,
            "RedirectCountLimit": 10,
            "HeaderList": [
              {
                "HeaderName": "User-Agent",
                "HeaderValue": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
              }
            ],
            "CheckPointList": [
              {
                "CheckPoint": "",
                "CheckType": "STATUS_CODE",
                "Operator": "eq",
                "ExpectValue": "200"
              }
            ]
          }
        ]
      }
    ],
    "LoadConfig": {
      "TestMode": "concurrency_mode",
      "MaxRunningTime": <DURATION_MINUTES>,
      "AutoStep": false,
      "Configuration": {
        "AllConcurrencyBegin": <CONCURRENCY>,
        "AllConcurrencyLimit": <CONCURRENCY>
      }
    },
    "AdvanceSetting": {
      "LogRate": 1,
      "ConnectionTimeoutInSecond": 5
    }
  }' \
  --user-agent AlibabaCloud-Agent-Skills
Parameter Notes:
  • MaxRunningTime
    : Duration in minutes (not seconds), range [1-1440]
  • TestMode
    : Use
    concurrency_mode
    for concurrent user testing or
    tps_mode
    for RPS testing
  • TimeoutInSecond
    : Request timeout in seconds (recommended: 10)
  • RedirectCountLimit
    : Maximum redirects allowed (use
    10
    for normal,
    0
    to disable)
  • HeaderList
    : HTTP headers, User-Agent is recommended for better compatibility
  • CheckPointList
    : Assertions for response validation (STATUS_CODE, BODY_JSON, etc.)
  • AdvanceSetting.LogRate
    : Log sampling rate (1-100)
  • AdvanceSetting.ConnectionTimeoutInSecond
    : Connection timeout (recommended: 5)
For complete JSON structure with all fields (POST requests, file parameters, global variables, etc.), see references/pts-scene-json-reference.md
注意: 使用
save-pts-scene
而非
create-pts-scene
--scene
参数直接传入JSON对象(不需要包裹在
Scene
字段中)。
幂等性说明: 不同场景的
SceneName
可能重复,请勿仅根据名称跳过创建或选择场景。
save-pts-scene
执行成功后,记录返回的**
SceneId
**用于后续所有步骤。如果命令失败或超时导致结果未知,重试前先调用
list-pts-scene
并与用户共同确认目标
SceneId
,避免盲目重试创建多余场景。
bash
aliyun pts save-pts-scene \
  --scene '{
    "SceneName": "<SCENE_NAME>",
    "RelationList": [
      {
        "RelationName": "serial-link-1",
        "ApiList": [
          {
            "ApiName": "api-1",
            "Url": "<TARGET_URL>",
            "Method": "<HTTP_METHOD>",
            "TimeoutInSecond": 10,
            "RedirectCountLimit": 10,
            "HeaderList": [
              {
                "HeaderName": "User-Agent",
                "HeaderValue": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
              }
            ],
            "CheckPointList": [
              {
                "CheckPoint": "",
                "CheckType": "STATUS_CODE",
                "Operator": "eq",
                "ExpectValue": "200"
              }
            ]
          }
        ]
      }
    ],
    "LoadConfig": {
      "TestMode": "concurrency_mode",
      "MaxRunningTime": <DURATION_MINUTES>,
      "AutoStep": false,
      "Configuration": {
        "AllConcurrencyBegin": <CONCURRENCY>,
        "AllConcurrencyLimit": <CONCURRENCY>
      }
    },
    "AdvanceSetting": {
      "LogRate": 1,
      "ConnectionTimeoutInSecond": 5
    }
  }' \
  --user-agent AlibabaCloud-Agent-Skills
参数说明:
  • MaxRunningTime
    : 测试时长,单位分钟(不是秒),取值范围[1-1440]
  • TestMode
    : 并发用户测试使用
    concurrency_mode
    ,RPS测试使用
    tps_mode
  • TimeoutInSecond
    : 请求超时时间,单位秒(推荐值:10)
  • RedirectCountLimit
    : 最大允许重定向次数(常规场景使用
    10
    ,填
    0
    可禁用重定向)
  • HeaderList
    : HTTP请求头,推荐携带User-Agent提升兼容性
  • CheckPointList
    : 响应校验断言(支持STATUS_CODE、BODY_JSON等类型)
  • AdvanceSetting.LogRate
    : 日志采样率(取值1-100)
  • AdvanceSetting.ConnectionTimeoutInSecond
    : 连接超时时间(推荐值:5)
完整的JSON结构(含POST请求、文件参数、全局变量等)请参考 references/pts-scene-json-reference.md

Task 1.2: Start Stress Testing

任务1.2:启动压测

[MUST] Pre-flight Safety Checks — Starting a stress test sends significant traffic to the target system. ALL of the following checks MUST pass before executing
start-pts-scene
:
  1. Idempotency guard — Run
    get-pts-scene-running-status --scene-id <SCENE_ID>
    . If the status is
    RUNNING
    or
    SYNCING
    , the test is already in progress — skip the start command and proceed to monitoring. Do NOT start a duplicate test.
  2. Retrieve and verify scene configuration — Run
    get-pts-scene --scene-id <SCENE_ID>
    and confirm the response contains a valid
    SceneName
    , at least one
    RelationList
    entry with a non-empty
    Url
    , and a valid
    LoadConfig
    (non-zero
    MaxRunningTime
    and concurrency). If any field is missing or empty, abort and notify the user.
  3. Display test summary and require explicit user confirmation — Present the following to the user and wait for explicit approval (e.g., "yes" / "确认"):
    • Target URL(s)
    • Concurrency level
    • Test duration
    • Test mode (concurrency / TPS)
    Do NOT proceed without the user's explicit "go-ahead" confirmation.
bash
undefined
[必须] 前置安全检查 — 启动压测会向目标系统发送大量流量,执行
start-pts-scene
前必须通过所有以下检查:
  1. 幂等性防护 — 运行
    get-pts-scene-running-status --scene-id <SCENE_ID>
    ,如果状态为
    RUNNING
    SYNCING
    ,说明测试已经在运行中,跳过启动命令直接进入监控流程,不要启动重复测试。
  2. 拉取并验证场景配置 — 运行
    get-pts-scene --scene-id <SCENE_ID>
    ,确认返回结果包含有效的
    SceneName
    、至少一个包含非空
    Url
    RelationList
    条目,以及有效的
    LoadConfig
    (非零的
    MaxRunningTime
    和并发数)。如果有字段缺失或为空,终止操作并通知用户。
  3. 展示测试摘要并要求用户明确确认 — 向用户展示以下信息并等待明确批准(例如"yes"/"确认"):
    • 目标URL列表
    • 并发量级
    • 测试时长
    • 测试模式(并发/TPS)
未获得用户明确的「同意执行」确认前,请勿继续操作。
bash
undefined

Idempotency guard: Skip if test is already running

幂等性防护:如果测试已在运行则跳过启动

aliyun pts get-pts-scene-running-status
--scene-id <SCENE_ID>
--user-agent AlibabaCloud-Agent-Skills
aliyun pts get-pts-scene-running-status
--scene-id <SCENE_ID>
--user-agent AlibabaCloud-Agent-Skills

↑ If status is RUNNING or SYNCING, skip start-pts-scene and go to monitoring.

↑ 如果状态为RUNNING或SYNCING,跳过start-pts-scene直接进入监控流程

Pre-flight check: Verify scene configuration is complete

前置检查:验证场景配置完整

aliyun pts get-pts-scene
--scene-id <SCENE_ID>
--user-agent AlibabaCloud-Agent-Skills
aliyun pts get-pts-scene
--scene-id <SCENE_ID>
--user-agent AlibabaCloud-Agent-Skills

Start stress testing (only after all checks pass and user confirms)

启动压测(仅在所有检查通过且用户确认后执行)

aliyun pts start-pts-scene
--scene-id <SCENE_ID>
--user-agent AlibabaCloud-Agent-Skills
undefined
aliyun pts start-pts-scene
--scene-id <SCENE_ID>
--user-agent AlibabaCloud-Agent-Skills
undefined

Task 1.3: Monitor Testing Status

任务1.3:监控测试状态

bash
aliyun pts get-pts-scene-running-status \
  --scene-id <SCENE_ID> \
  --user-agent AlibabaCloud-Agent-Skills
bash
aliyun pts get-pts-scene-running-status \
  --scene-id <SCENE_ID> \
  --user-agent AlibabaCloud-Agent-Skills

Task 1.4: Get Testing Report

任务1.4:获取测试报告

bash
aliyun pts get-pts-report-details \
  --scene-id <SCENE_ID> \
  --plan-id <PLAN_ID> \
  --user-agent AlibabaCloud-Agent-Skills
bash
aliyun pts get-pts-report-details \
  --scene-id <SCENE_ID> \
  --plan-id <PLAN_ID> \
  --user-agent AlibabaCloud-Agent-Skills

Workflow 2: Create and Run JMeter Stress Testing

工作流2:创建并运行JMeter压测

Task 2.1: Create JMeter Scenario

任务2.1:创建JMeter场景

Idempotency:
SceneName
may duplicate across JMeter scenarios. Do not dedupe by name. After
save-open-jmeter-scene
succeeds, record the returned
SceneId
. On uncertain failure, use
list-open-jmeter-scenes
with the user to disambiguate before retrying.
bash
aliyun pts save-open-jmeter-scene \
  --open-jmeter-scene '{
    "SceneName": "<SCENE_NAME>",
    "TestFile": "<JMX_FILENAME>",
    "Duration": <DURATION>,
    "Concurrency": <CONCURRENCY>,
    "Mode": "CONCURRENCY"
  }' \
  --user-agent AlibabaCloud-Agent-Skills
幂等性说明: 不同JMeter场景的
SceneName
可能重复,请勿按名称去重。
save-open-jmeter-scene
执行成功后,记录返回的**
SceneId
**。如果调用失败结果未知,重试前先调用
list-open-jmeter-scenes
并与用户共同确认目标场景。
bash
aliyun pts save-open-jmeter-scene \
  --open-jmeter-scene '{
    "SceneName": "<SCENE_NAME>",
    "TestFile": "<JMX_FILENAME>",
    "Duration": <DURATION>,
    "Concurrency": <CONCURRENCY>,
    "Mode": "CONCURRENCY"
  }' \
  --user-agent AlibabaCloud-Agent-Skills

Task 2.2: Start JMeter Testing

任务2.2:启动JMeter测试

[MUST] Pre-flight Safety Checks — Starting a JMeter stress test sends significant traffic to the target system. ALL of the following checks MUST pass before executing
start-testing-jmeter-scene
:
  1. Idempotency guard — Run
    get-open-jmeter-scene --scene-id <SCENE_ID>
    and check the scene status. If the test is already running, skip the start command and proceed to monitoring. Do NOT start a duplicate test.
  2. Verify scene configuration — From the same response, confirm it contains a valid
    SceneName
    , a non-empty
    TestFile
    , and non-zero
    Duration
    and
    Concurrency
    . If any field is missing or empty, abort and notify the user.
  3. Display test summary and require explicit user confirmation — Present the following to the user and wait for explicit approval (e.g., "yes" / "确认"):
    • Scene name and JMX file
    • Concurrency level
    • Test duration
    Do NOT proceed without the user's explicit "go-ahead" confirmation.
bash
undefined
[必须] 前置安全检查 — 启动JMeter压测会向目标系统发送大量流量,执行
start-testing-jmeter-scene
前必须通过所有以下检查:
  1. 幂等性防护 — 运行
    get-open-jmeter-scene --scene-id <SCENE_ID>
    检查场景状态,如果测试已经在运行中,跳过启动命令直接进入监控流程,不要启动重复测试。
  2. 验证场景配置 — 从上述接口的返回结果中,确认包含有效的
    SceneName
    、非空的
    TestFile
    、非零的
    Duration
    Concurrency
    。如果有字段缺失或为空,终止操作并通知用户。
  3. 展示测试摘要并要求用户明确确认 — 向用户展示以下信息并等待明确批准(例如"yes"/"确认"):
    • 场景名称和JMX文件
    • 并发量级
    • 测试时长
未获得用户明确的「同意执行」确认前,请勿继续操作。
bash
undefined

Idempotency guard + pre-flight check: Verify scene config and check if already running

幂等性防护+前置检查:验证场景配置并检查是否已在运行

aliyun pts get-open-jmeter-scene
--scene-id <SCENE_ID>
--user-agent AlibabaCloud-Agent-Skills
aliyun pts get-open-jmeter-scene
--scene-id <SCENE_ID>
--user-agent AlibabaCloud-Agent-Skills

↑ If already running, skip start command. If config is incomplete, abort.

↑ 如果已在运行则跳过启动命令,如果配置不完整则终止操作

Start JMeter testing (only after all checks pass and user confirms)

启动JMeter测试(仅在所有检查通过且用户确认后执行)

aliyun pts start-testing-jmeter-scene
--scene-id <SCENE_ID>
--user-agent AlibabaCloud-Agent-Skills
undefined
aliyun pts start-testing-jmeter-scene
--scene-id <SCENE_ID>
--user-agent AlibabaCloud-Agent-Skills
undefined

Task 2.3: Get JMeter Report

任务2.3:获取JMeter报告

bash
aliyun pts get-jmeter-report-details \
  --report-id <REPORT_ID> \
  --user-agent AlibabaCloud-Agent-Skills
bash
aliyun pts get-jmeter-report-details \
  --report-id <REPORT_ID> \
  --user-agent AlibabaCloud-Agent-Skills

Workflow 3: Manage Scenarios

工作流3:场景管理

Task 3.1: List All PTS Scenarios

任务3.1:列出所有PTS场景

bash
aliyun pts list-pts-scene \
  --page-number 1 \
  --page-size 10 \
  --user-agent AlibabaCloud-Agent-Skills
bash
aliyun pts list-pts-scene \
  --page-number 1 \
  --page-size 10 \
  --user-agent AlibabaCloud-Agent-Skills

Task 3.2: List All JMeter Scenarios

任务3.2:列出所有JMeter场景

bash
aliyun pts list-open-jmeter-scenes \
  --page-number 1 \
  --page-size 10 \
  --user-agent AlibabaCloud-Agent-Skills
bash
aliyun pts list-open-jmeter-scenes \
  --page-number 1 \
  --page-size 10 \
  --user-agent AlibabaCloud-Agent-Skills

Task 3.3: Get Scenario Details

任务3.3:获取场景详情

bash
undefined
bash
undefined

PTS scenario

PTS场景

aliyun pts get-pts-scene
--scene-id <SCENE_ID>
--user-agent AlibabaCloud-Agent-Skills
aliyun pts get-pts-scene
--scene-id <SCENE_ID>
--user-agent AlibabaCloud-Agent-Skills

JMeter scenario

JMeter场景

aliyun pts get-open-jmeter-scene
--scene-id <SCENE_ID>
--user-agent AlibabaCloud-Agent-Skills
undefined
aliyun pts get-open-jmeter-scene
--scene-id <SCENE_ID>
--user-agent AlibabaCloud-Agent-Skills
undefined

Task 3.4: Debug Scenario (PTS only)

任务3.4:调试场景(仅PTS支持)

bash
aliyun pts start-debug-pts-scene \
  --scene-id <SCENE_ID> \
  --user-agent AlibabaCloud-Agent-Skills
bash
aliyun pts start-debug-pts-scene \
  --scene-id <SCENE_ID> \
  --user-agent AlibabaCloud-Agent-Skills

Task 3.5: Stop Running Test

任务3.5:停止运行中的测试

bash
undefined
bash
undefined

Stop PTS test

停止PTS测试

aliyun pts stop-pts-scene
--scene-id <SCENE_ID>
--user-agent AlibabaCloud-Agent-Skills
aliyun pts stop-pts-scene
--scene-id <SCENE_ID>
--user-agent AlibabaCloud-Agent-Skills

Stop JMeter test

停止JMeter测试

aliyun pts stop-testing-jmeter-scene
--scene-id <SCENE_ID>
--user-agent AlibabaCloud-Agent-Skills
undefined
aliyun pts stop-testing-jmeter-scene
--scene-id <SCENE_ID>
--user-agent AlibabaCloud-Agent-Skills
undefined

Success Verification Method

成功验证方法

IMPORTANT:
start-pts-scene
may return
Success: true
even when the stress test fails to actually launch (e.g., due to target site protection or missing configuration). Always verify actual execution status.
After each operation, verify success using the verification commands in references/verification-method.md.
Verify scenario creation:
bash
undefined
重要提示: 即使
start-pts-scene
返回
Success: true
,压测也可能实际启动失败(例如目标站点有防护、配置缺失等问题),请始终验证实际执行状态。
每次操作完成后,请使用 references/verification-method.md 中的验证命令确认操作成功。
验证场景创建成功:
bash
undefined

Use list-pts-scene instead of get-pts-scene (more reliable)

使用list-pts-scene比get-pts-scene更可靠

aliyun pts list-pts-scene
--page-number 1
--page-size 10
--user-agent AlibabaCloud-Agent-Skills

**Verify stress test is actually running:**
```bash
aliyun pts list-pts-scene
--page-number 1
--page-size 10
--user-agent AlibabaCloud-Agent-Skills

**验证压测实际在运行:**
```bash

Check running status first

先检查运行状态

aliyun pts get-pts-scene-running-status
--scene-id <SCENE_ID>
--user-agent AlibabaCloud-Agent-Skills
aliyun pts get-pts-scene-running-status
--scene-id <SCENE_ID>
--user-agent AlibabaCloud-Agent-Skills

Then verify with running data (requires plan-id from start-pts-scene)

再通过运行数据验证(需要使用start-pts-scene返回的plan-id)

aliyun pts get-pts-scene-running-data
--scene-id <SCENE_ID>
--plan-id <PLAN_ID>
--user-agent AlibabaCloud-Agent-Skills

**Key indicators of successful execution:**
- `Status`: Should be "RUNNING" or "SYNCING" (not "STOPPED" immediately)
- `AliveAgents`: Should be > 0
- `Concurrency`: Should match configured value
- `TotalRequestCount`: Should be increasing
aliyun pts get-pts-scene-running-data
--scene-id <SCENE_ID>
--plan-id <PLAN_ID>
--user-agent AlibabaCloud-Agent-Skills

**执行成功的关键指标:**
- `Status`: 应为"RUNNING"或"SYNCING"(不会立即变为"STOPPED")
- `AliveAgents`: 应大于0
- `Concurrency`: 应与配置值匹配
- `TotalRequestCount`: 应持续增长

Cleanup

清理

Delete scenarios when no longer needed.
[MUST] Pre-delete Safety Checks — Before deleting any scenario, ALL of the following checks MUST pass:
  1. Idempotency guard — Using the target
    SceneId
    (not name), verify it still exists (e.g.
    list-pts-scene
    /
    list-open-jmeter-scenes
    or
    get-*
    ). If that
    SceneId
    is absent, treat deletion as already done and skip the delete command.
  2. Check if the scenario is currently running — Run
    get-pts-scene-running-status --scene-id <SCENE_ID>
    (PTS) or check JMeter scene status. If the scenario status is
    RUNNING
    or
    SYNCING
    , you MUST stop it first using
    stop-pts-scene
    /
    stop-testing-jmeter-scene
    and wait for it to fully stop before deleting. Do NOT delete a running scenario.
  3. Require explicit user confirmation — Display the scene name and ID to the user and ask for explicit deletion confirmation (e.g., "yes" / "确认删除"). Do NOT proceed without the user's explicit approval.
bash
undefined
不再需要的场景请及时删除。
[必须] 删除前安全检查 — 删除任何场景前,必须通过所有以下检查:
  1. 幂等性防护 — 使用目标**
    SceneId
    **(不是名称)验证场景仍存在(例如调用
    list-pts-scene
    /
    list-open-jmeter-scenes
    或对应的get接口)。如果
    SceneId
    不存在,视为已完成删除,跳过删除命令。
  2. 检查场景是否正在运行 — 调用
    get-pts-scene-running-status --scene-id <SCENE_ID>
    (PTS场景)或检查JMeter场景状态。如果场景状态为
    RUNNING
    SYNCING
    ,必须先使用
    stop-pts-scene
    /
    stop-testing-jmeter-scene
    停止测试,等待完全停止后再删除,请勿删除运行中的场景。
  3. 要求用户明确确认 — 向用户展示场景名称和ID,要求明确的删除确认(例如"yes"/"确认删除")。未获得用户明确批准前,请勿继续操作。
bash
undefined

Pre-delete check: Verify scenario is not running

删除前检查:验证场景未在运行

aliyun pts get-pts-scene-running-status
--scene-id <SCENE_ID>
--user-agent AlibabaCloud-Agent-Skills
aliyun pts get-pts-scene-running-status
--scene-id <SCENE_ID>
--user-agent AlibabaCloud-Agent-Skills

Delete PTS scenario (only after confirming it is not running and user approves)

删除PTS场景(仅在确认未运行且用户批准后执行)

aliyun pts delete-pts-scene
--scene-id <SCENE_ID>
--user-agent AlibabaCloud-Agent-Skills
aliyun pts delete-pts-scene
--scene-id <SCENE_ID>
--user-agent AlibabaCloud-Agent-Skills

Delete JMeter scenario (only after confirming it is not running and user approves)

删除JMeter场景(仅在确认未运行且用户批准后执行)

aliyun pts remove-open-jmeter-scene
--scene-id <SCENE_ID>
--user-agent AlibabaCloud-Agent-Skills
undefined
aliyun pts remove-open-jmeter-scene
--scene-id <SCENE_ID>
--user-agent AlibabaCloud-Agent-Skills
undefined

API and Command Tables

API和命令表

See references/related-apis.md for complete API and CLI command reference.
完整的API和CLI命令参考请查看 references/related-apis.md

Best Practices

最佳实践

  1. Use complete scene configuration - Always include
    TimeoutInSecond
    ,
    HeaderList
    (with User-Agent),
    CheckPointList
    , and
    AdvanceSetting
    for reliable test execution
  2. Always confirm parameters - Verify target URLs, concurrency settings, and duration with the user before execution
  3. Start with low concurrency - Begin with low concurrency and gradually increase to identify performance thresholds
  4. Verify actual execution - Don't trust
    Success: true
    from
    start-pts-scene
    ; always check
    get-pts-scene-running-data
    with
    --plan-id
  5. Use debug mode first - For PTS scenarios, use
    start-debug-pts-scene
    to validate configuration before full tests
  6. Monitor during tests - Regularly check running status during stress tests
  7. Review reports thoroughly - Analyze response times, error rates, and throughput in reports
  8. Clean up after testing - Delete test scenarios to avoid unnecessary costs
  9. Use appropriate test duration - Longer tests provide more accurate results but consume more resources
  10. Include warmup period - Allow time for systems to warm up before measuring peak performance
  1. 使用完整的场景配置 - 始终携带
    TimeoutInSecond
    HeaderList
    (含User-Agent)、
    CheckPointList
    AdvanceSetting
    ,确保测试执行可靠
  2. 始终确认参数 - 执行前与用户确认目标URL、并发设置和时长
  3. 从低并发开始测试 - 先使用低并发启动,逐步提升量级,确认性能阈值
  4. 验证实际执行状态 - 不要信任
    start-pts-scene
    返回的
    Success: true
    ,始终通过
    get-pts-scene-running-data
    配合
    --plan-id
    校验
  5. 优先使用调试模式 - PTS场景正式测试前,先使用
    start-debug-pts-scene
    验证配置有效性
  6. 测试过程中持续监控 - 压测期间定期检查运行状态
  7. 完整分析报告 - 详细分析报告中的响应时间、错误率和吞吐量数据
  8. 测试完成后清理资源 - 删除测试场景避免产生不必要的费用
  9. 使用合适的测试时长 - 更长的测试时长可提供更准确的结果,但会消耗更多资源
  10. 预留预热时间 - 测量峰值性能前,预留系统预热时间

Reference Links

参考链接

ReferenceDescription
cli-installation-guide.mdAliyun CLI installation and configuration
related-apis.mdComplete API and CLI command reference
ram-policies.mdRAM permission policies
verification-method.mdVerification steps for each operation
pts-scene-json-reference.mdComplete PTS scene JSON structure reference
acceptance-criteria.mdAcceptance criteria for skill validation
参考文档说明
cli-installation-guide.mdAliyun CLI安装与配置指南
related-apis.md完整API和CLI命令参考
ram-policies.mdRAM权限策略说明
verification-method.md各操作的验证步骤
pts-scene-json-reference.md完整PTS场景JSON结构参考
acceptance-criteria.md技能验证的验收标准