API测试
安装方式
先用 Prompt 核对来源,也可切换到安装命令或下载可用的安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "api-testing":https://skillpi.com/zh/skills/deepskill-df9a0b75a02741b1a666ac37a44da74811e4cd8e45a3fd0dfd09b8f789c965bb。安装前核对上游来源和版本:https://github.com/jeremylongshore/tons-of-skills-marketplace/blob/6ea46b08dce892944db7c16f28d0b5308d402402/plugins/productivity/cli-power-skills/skills/api-testing/SKILL.md。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
此命令从 GitHub 来源仓库获取指定技能。运行前请先查看源文件。
npx skills add https://github.com/jeremylongshore/tons-of-skills-marketplace/tree/6ea46b08dce892944db7c16f28d0b5308d402402/plugins/productivity/cli-power-skills/skills/api-testing --skill api-testing来源与配置
查看 GitHub 源码jeremylongshore/tons-of-skills-marketplace固定提交 6ea46b08dce892944db7c16f28d0b5308d402402
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
本条目介绍 API测试 的公开用途。DeepSkill 当前公开目录说明:“用于测试 HTTP 端点、探测 URL 的状态和响应头,或从纯文本文件中运行声明式 API 测试套件” 适用场景包括测试与安全校验、调试 API 与排查日志。本页根据公开目录资料和固定版本的上游仓库整理,建议使用前核对该版本的环境、工具、权限及数据处理要求。Skillπ 提供站方用途介绍与原站链接;原始 SKILL.md 和附件仅在对应许可允许时开放。
文件浏览
---
name: api-testing
description: "Use when testing HTTP endpoints, probing URLs for status and headers, or running declarative API test suites from plain text files"
allowed-tools: [Bash(hurl*), Bash(httpx*), Read, Write, Glob]
version: 1.0.0
author: ykotik
license: MIT
---
# API Testing
## When to Use
- Testing REST API endpoints for correct responses
- Writing declarative, repeatable HTTP test suites
- Chaining HTTP requests (authenticate → create → verify)
- Probing multiple URLs for availability, status codes, or headers
- Validating response bodies, headers, and status codes with assertions
## Tools
| Tool | Purpose | Structured output |
|------|---------|-------------------|
| **Hurl** | Declarative HTTP testing from plain text `.hurl` files | `--json` for JSON report |
| **httpx** | Fast HTTP probing toolkit (ProjectDiscovery) | `-json` for JSON output |
## Patterns
### Hurl: Simple GET with status assertion
Create a `.hurl` file:
```hurl
GET http://localhost:3000/api/health
HTTP 200
[Asserts]
jsonpath "$.status" == "ok"
```
Run it:
```bash
hurl health.hurl
```
### Hurl: POST with JSON body and response validation
```hurl
POST http://localhost:3000/api/users
Content-Type: application/json
{
"name": "Alice",
"email": "alice@example.com"
}
HTTP 201
[Asserts]
jsonpath "$.id" isInteger
jsonpath "$.name" == "Alice"
```
### Hurl: Chained requests (auth → create → verify)
```hurl
# Step 1: Login
POST http://localhost:3000/api/auth/login
Content-Type: application/json
{
"email": "admin@example.com",
"password": "secret"
}
HTTP 200
[Captures]
token: jsonpath "$.token"
# Step 2: Create resource with token
POST http://localhost:3000/api/items
Authorization: Bearer {{token}}
Content-Type: application/json
{
"title": "New Item"
}
HTTP 201
[Captures]
item_id: jsonpath "$.id"
# Step 3: Verify resource exists
GET http://localhost:3000/api/items/{{item_id}}
Authorization: Bearer {{token}}
HTTP 200
[Asserts]
jsonpath "$.title" == "New Item"
```
### Hurl: Run test suite with JSON report
```bash
hurl --test --report-json report/ tests/*.hurl
```
### Hurl: Use variables from command line
```bash
hurl --variable host=https://staging.example.com --variable token=abc123 tests/api.hurl
```
### httpx: Probe a list of URLs for status codes
```bash
echo -e "https://example.com\nhttps://httpbin.org\nhttps://nonexistent.invalid" | httpx -silent -status-code
```
### httpx: Probe with full JSON output (status, title, tech)
```bash
echo "https://example.com" | httpx -json -title -tech-detect -status-code
```
### httpx: Check specific ports across hosts
```bash
echo -e "192.168.1.1\n192.168.1.2" | httpx -ports 80,443,8080 -status-code
```
### httpx: Follow redirects and show final URL
```bash
echo "http://github.com" | httpx -follow-redirects -location -status-code
```
## Pipelines
### Hurl test suite → summarize failures
```bash
hurl --test --report-json report/ tests/*.hurl 2>&1; jq '[.[] | select(.success == false) | {file: .filename, errors: [.entries[] | select(.errors | length > 0) | .errors]}]' report/*.json
```
Each stage: Hurl runs all tests and writes JSON reports, jq filters to failures and extracts error details.
### Discover endpoints with Katana → probe with httpx
```bash
katana -u https://example.com -silent -d 2 | httpx -silent -status-code -json
```
Each stage: Katana crawls and discovers URLs, httpx probes each for status and metadata.
## Prefer Over
- Prefer **Hurl** over curl scripts for multi-step API testing — declarative syntax with built-in assertions, no bash scripting needed
- Prefer **Hurl** over Postman/Bruno for CI-friendly test suites — plain text files, no GUI dependency
- Prefer **httpx** over curl loops for probing many URLs — concurrent, structured output, built for scale
## Do NOT Use When
- Need full browser rendering or JavaScript execution — use web-crawling skill (Playwright)
- Building a long-running API client or SDK — write code instead
- Testing WebSocket or gRPC endpoints — use specialized tools (wscat, grpcurl)
- Single ad-hoc curl request — just use `curl` directly
当前收录版本
1.0.0
质量评测
满分 100。前四项来自 DeepSkill 收录的质量报告。
评分依据
提供 HTTP 端点测试、URL 探测、声明式 API 测试套件运行等核心功能,满足开发者高频刚需场景
评分依据
description 明确列出三大使用场景,边界清晰,覆盖多种变体
评分依据
文档结构完整,包含 When to Use、Tools、Patterns、Pipelines 等必要章节
评分依据
工具来源明确(Hurl、httpx),参数使用正确
计算方式
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
文档引用的域名或地址
这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。
- example.com
- github.com
- localhost
- staging.example.com
安全评级与访问范围
risk · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。