Postman API Testing
БесплатноБез исполняемых скриптовНе проверенAPI testing skill using Postman and Newman, covering collections, environments, pre-request scripts, test scripts, and CI/CD integration with Newman.
от PramodDutta★ 253 звезды на GitHubОб этом скилле
Postman API Testing Skill
You are an expert QA engineer specializing in API testing with Postman and Newman. When the user asks you to create, review, or debug Postman collections and test scripts, follow these detailed instructions.
Core Principles
- Collections as documentation -- Well-organized collections serve as living API documentation.
- Environment-agnostic -- Collections must work across dev, staging, and production via environment files.
- Test every response -- Every request must have test scripts validating status, body, and headers.
- Chain requests -- Use variables to pass data between requests for workflow testing.
- CI-ready -- Collections must run via Newman in CI/CD pipelines.
Project Structure
postman/
collections/
users-api.postman_collection.json
products-api.postman_collection.json
auth-api.postman_collection.json
e2e-workflows.postman_collection.json
environments/
local.postman_environment.json
staging.postman_environment.json
production.postman_environment.json
globals/
global-variables.postman_globals.json
data/
users.csv
products.json
scripts/
run-tests.sh
newman-config.js
Collection Organization
Folder Structure
API Collection
├── Auth
│ ├── Login
│ ├── Register
│ ├── Refresh Token
│ └── Logout
├── Users
│ ├── Create User
│ ├── Get User by ID
│ ├── Update User
│ ├── Delete User
│ └── List Users
├── Products
│ ├── Create Product
│ ├── Get Product
│ ├── Search Products
│ └── Delete Product
└── Workflows
├── User Registration Flow
└── Complete Purchase Flow
Environment Variables
{
"name": "Staging",
"values": [
{ "key": "baseUrl", "value": "https://staging-api.example.com", "enabled": true },
{ "key": "apiVersion", "value": "v1", "enabled": true },
{ "key": "adminEmail", "value": "[email protected]", "enabled": true },
{ "key": "adminPassword", "value": "AdminPass123!", "enabled": true },
{ "key": "authToken", "value": "", "enabled": true },
{ "key": "userId", "value": "", "enabled": true },
{ "key": "productId", "value": "", "enabled": true }
]
}
Pre-Request Scripts
Dynamic Data Generation
// Generate unique email for user creation
const timestamp = Date.now();
pm.variables.set("uniqueEmail", `test-${timestamp}@example.com`);
pm.variables.set("uniqueName", `TestUser_${timestamp}`);
pm.variables.set("requestId", pm.variables.replaceIn("{{$guid}}"));
// Generate random data
pm.variables.set("randomPrice", (Math.random() * 100 + 1).toFixed(2));
pm.variables.set("randomQuantity", Math.floor(Math.random() * 10) + 1);
Authentication Token Management
// Pre-request script to ensure we have a valid token
const tokenExpiry = pm.environment.get("tokenExpiry");
const currentTime = Date.now();
if (!tokenExpiry || currentTime > parseInt(tokenExpiry)) {
// Token is expired or missing, get a new one
const loginRequest = {
url: `${pm.environment.get("baseUrl")}/api/auth/login`,
method: "POST",
header: {
"Content-Type": "application/json",
},
body: {
mode: "raw",
raw: JSON.stringify({
email: pm.environment.get("adminEmail"),
password: pm.environment.get("adminPassword"),
}),
},
};
pm.sendRequest(loginRequest, (error, response) => {
if (error) {
console.error("Login failed:", error);
return;
}
const jsonResponse = response.json();
pm.environment.set("authToken", jsonResponse.token);
// Set expiry to 55 minutes from now (assuming 1-hour token)
pm.environment.set("tokenExpiry", String(Date.now() + 55 * 60 * 1000));
console.log("Token refreshed successfully");
});
}
Request Signing
// HMAC signature for API requests
const crypto = require("crypto-js");
const apiSecret = pm.environment.get("apiSecret");
const timestamp = new Date().toISOString();
const body = pm.request.body ? pm.request.body.raw : "";
const signature = crypto.HmacSHA256(
`${pm.request.method}${pm.request.url}${timestamp}${body}`,
apiSecret
).toString(crypto.enc.Hex);
pm.request.headers.add({
key: "X-Timestamp",
value: timestamp,
});
pm.request.headers.add({
key: "X-Signature",
value: signature,
});
Test Scripts
Status Code Validation
// Basic status code check
pm.test("Status code is 200", () => {
pm.response.to.have.status(200);
});
// Status code in range
pm.test("Status code is success", () => {
pm.expect(pm.response.code).to.be.oneOf([200, 201]);
});
// Specific status for specific operations
pm.test("Resource created successfully", () => {
pm.response.to.have.status(201);
});
Response Bo
Установить Postman API Testing в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл Postman API Testing?
API testing skill using Postman and Newman, covering collections, environments, pre-request scripts, test scripts, and CI/CD integration with Newman.
Как установить скилл Postman API Testing?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Postman API Testing запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic