Loading...
Loading...
Alibaba Cloud PTS (Performance Testing Service) scenario-based skill for creating and managing stress testing scenarios. Supports both PTS native HTTP/HTTPS stress testing and JMeter-based stress testing. Triggers: "PTS", "压测", "性能测试", "stress testing", "performance testing", "JMeter", "load testing", "创建压测场景"
npx skill4agent add aliyun/alibabacloud-aiops-skills alibabacloud-pts-opsUser → Aliyun CLI → PTS Service → Target Application
↓
Stress Testing ReportPre-check: Aliyun CLI >= 3.3.1 required Runto verify >= 3.3.1. If not installed or version too low, see references/cli-installation-guide.md for installation instructions. Then [MUST] runaliyun versionto enable automatic plugin installation.aliyun configure set --auto-plugin-install true
# Verify CLI version
aliyun version
# Enable auto plugin installation
aliyun configure set --auto-plugin-install true# Recommended timeout settings for PTS operations
--read-timeout 60 --connect-timeout 10IMPORTANT: 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.
| Parameter Name | Required | Description | Default Value |
|---|---|---|---|
| RegionId | No | Region for PTS service | cn-hangzhou |
| Scene Name | Yes | Name of the stress testing scenario | - |
| Target URL | Yes | URL to stress test | - |
| HTTP Method | Yes | GET, POST, PUT, DELETE, etc. | GET |
| Concurrency | Yes | Number of concurrent users | - |
| Duration | Yes | Test duration in seconds | - |
| JMX File | Yes (JMeter) | Path to JMeter script file | - |
| Mode | No | CONCURRENCY or TPS | CONCURRENCY |
aliyun configure getClientTokenSceneNameSceneId| Operation | Check Before Acting | If Already Exists / Running |
|---|---|---|
Create PTS scene ( | Do not dedupe by name. After success, record | If the prior call outcome is unknown, use |
Create JMeter scene ( | Same as PTS — names may duplicate; use | Same pattern with |
Start PTS test ( | | If |
Start JMeter test ( | | If already running, skip; do NOT start again |
Delete PTS scene ( | Confirm target | If that |
Delete JMeter scene ( | Confirm target | If that |
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.
Note: Useinstead ofsave-pts-scene. Thecreate-pts-sceneparameter accepts a JSON object directly (not wrapped in a--scenefield).Scene
Idempotency:may duplicate across scenarios. Do not skip creation or pick a scene based on name alone. AfterSceneNamesucceeds, record the returnedsave-pts-scenefor all later steps. If the command fails or times out with unknown outcome, useSceneIdtogether with the user to identify the intendedlist-pts-scenebefore retrying — avoid blind retries that create extra scenes.SceneId
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-SkillsMaxRunningTimeTestModeconcurrency_modetps_modeTimeoutInSecondRedirectCountLimit100HeaderListCheckPointListAdvanceSetting.LogRateAdvanceSetting.ConnectionTimeoutInSecondFor complete JSON structure with all fields (POST requests, file parameters, global variables, etc.), see references/pts-scene-json-reference.md
[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
- Idempotency guard — Run
. If the status isget-pts-scene-running-status --scene-id <SCENE_ID>orRUNNING, the test is already in progress — skip the start command and proceed to monitoring. Do NOT start a duplicate test.SYNCING- Retrieve and verify scene configuration — Run
and confirm the response contains a validget-pts-scene --scene-id <SCENE_ID>, at least oneSceneNameentry with a non-emptyRelationList, and a validUrl(non-zeroLoadConfigand concurrency). If any field is missing or empty, abort and notify the user.MaxRunningTime- Display test summary and require explicit user confirmation — Present the following to the user and wait for explicit approval (e.g., "yes" / "确认"):
Do NOT proceed without the user's explicit "go-ahead" confirmation.
- Target URL(s)
- Concurrency level
- Test duration
- Test mode (concurrency / TPS)
# Idempotency guard: Skip if test is already running
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.
# Pre-flight check: Verify scene configuration is complete
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-Skillsaliyun pts get-pts-scene-running-status \
--scene-id <SCENE_ID> \
--user-agent AlibabaCloud-Agent-Skillsaliyun pts get-pts-report-details \
--scene-id <SCENE_ID> \
--plan-id <PLAN_ID> \
--user-agent AlibabaCloud-Agent-SkillsIdempotency:may duplicate across JMeter scenarios. Do not dedupe by name. AfterSceneNamesucceeds, record the returnedsave-open-jmeter-scene. On uncertain failure, useSceneIdwith the user to disambiguate before retrying.list-open-jmeter-scenes
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[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
- Idempotency guard — Run
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.get-open-jmeter-scene --scene-id <SCENE_ID>- Verify scene configuration — From the same response, confirm it contains a valid
, a non-emptySceneName, and non-zeroTestFileandDuration. If any field is missing or empty, abort and notify the user.Concurrency- Display test summary and require explicit user confirmation — Present the following to the user and wait for explicit approval (e.g., "yes" / "确认"):
Do NOT proceed without the user's explicit "go-ahead" confirmation.
- Scene name and JMX file
- Concurrency level
- Test duration
# 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
# ↑ If already running, skip start command. If config is incomplete, abort.
# Start JMeter testing (only after all checks pass and user confirms)
aliyun pts start-testing-jmeter-scene \
--scene-id <SCENE_ID> \
--user-agent AlibabaCloud-Agent-Skillsaliyun pts get-jmeter-report-details \
--report-id <REPORT_ID> \
--user-agent AlibabaCloud-Agent-Skillsaliyun pts list-pts-scene \
--page-number 1 \
--page-size 10 \
--user-agent AlibabaCloud-Agent-Skillsaliyun pts list-open-jmeter-scenes \
--page-number 1 \
--page-size 10 \
--user-agent AlibabaCloud-Agent-Skills# PTS scenario
aliyun pts get-pts-scene \
--scene-id <SCENE_ID> \
--user-agent AlibabaCloud-Agent-Skills
# JMeter scenario
aliyun pts get-open-jmeter-scene \
--scene-id <SCENE_ID> \
--user-agent AlibabaCloud-Agent-Skillsaliyun pts start-debug-pts-scene \
--scene-id <SCENE_ID> \
--user-agent AlibabaCloud-Agent-Skills# Stop PTS test
aliyun pts stop-pts-scene \
--scene-id <SCENE_ID> \
--user-agent AlibabaCloud-Agent-Skills
# Stop JMeter test
aliyun pts stop-testing-jmeter-scene \
--scene-id <SCENE_ID> \
--user-agent AlibabaCloud-Agent-SkillsIMPORTANT:may returnstart-pts-sceneeven when the stress test fails to actually launch (e.g., due to target site protection or missing configuration). Always verify actual execution status.Success: true
# Use list-pts-scene instead of get-pts-scene (more reliable)
aliyun pts list-pts-scene \
--page-number 1 \
--page-size 10 \
--user-agent AlibabaCloud-Agent-Skills# Check running status first
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)
aliyun pts get-pts-scene-running-data \
--scene-id <SCENE_ID> \
--plan-id <PLAN_ID> \
--user-agent AlibabaCloud-Agent-SkillsStatusAliveAgentsConcurrencyTotalRequestCount[MUST] Pre-delete Safety Checks — Before deleting any scenario, ALL of the following checks MUST pass:
- Idempotency guard — Using the target
(not name), verify it still exists (e.g.SceneId/list-pts-sceneorlist-open-jmeter-scenes). If thatget-*is absent, treat deletion as already done and skip the delete command.SceneId- Check if the scenario is currently running — Run
(PTS) or check JMeter scene status. If the scenario status isget-pts-scene-running-status --scene-id <SCENE_ID>orRUNNING, you MUST stop it first usingSYNCING/stop-pts-sceneand wait for it to fully stop before deleting. Do NOT delete a running scenario.stop-testing-jmeter-scene- 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.
# Pre-delete check: Verify scenario is not running
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)
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)
aliyun pts remove-open-jmeter-scene \
--scene-id <SCENE_ID> \
--user-agent AlibabaCloud-Agent-SkillsTimeoutInSecondHeaderListCheckPointListAdvanceSettingSuccess: truestart-pts-sceneget-pts-scene-running-data--plan-idstart-debug-pts-scene| Reference | Description |
|---|---|
| cli-installation-guide.md | Aliyun CLI installation and configuration |
| related-apis.md | Complete API and CLI command reference |
| ram-policies.md | RAM permission policies |
| verification-method.md | Verification steps for each operation |
| pts-scene-json-reference.md | Complete PTS scene JSON structure reference |
| acceptance-criteria.md | Acceptance criteria for skill validation |