ワンクリックで
api-testing
API testing best practices, tools, and workflows for RESTful API testing.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
API testing best practices, tools, and workflows for RESTful API testing.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Summarize and condense content effectively
Translate content between languages with context awareness
Code quality standards, metrics, and practices for maintaining clean, maintainable codebases.
Code review best practices, guidelines, and checklists for effective peer reviews.
Go debugging best practices, tools, and techniques for effective troubleshooting.
Technical documentation writing guidelines, standards, and best practices.
| name | api-testing |
| description | API testing best practices, tools, and workflows for RESTful API testing. |
| version | 1.0.0 |
| author | magic |
| license | MIT |
| metadata | {"hermes":{"tags":["api","testing","rest","automation"],"category":"software-development"}} |
Comprehensive guide for testing RESTful APIs using various tools and frameworks.
Load this skill when:
# GET request
curl -X GET https://api.example.com/users \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
# POST request
curl -X POST https://api.example.com/users \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{"name": "test", "email": "test@example.com"}'
# PUT request
curl -X PUT https://api.example.com/users/123 \
-H "Content-Type: application/json" \
-d '{"name": "updated"}'
# DELETE request
curl -X DELETE https://api.example.com/users/123 \
-H "Authorization: Bearer $TOKEN"
# With query parameters
curl "https://api.example.com/users?page=1&limit=10"
# Install: pip install httpie
# GET
http GET https://api.example.com/users Authorization:"Bearer $TOKEN"
# POST with JSON
http POST https://api.example.com/users \
name="test" email="test@example.com" \
Authorization:"Bearer $TOKEN"
| Tool | Platform | Best For |
|---|---|---|
| Postman | All | Full-featured API testing, collections |
| Insomnia | All | Lightweight, GraphQL support |
| Bruno | All | Open-source, offline-first |
| Hoppscotch | Web | Quick online testing |
| Tool | Install | Features |
|---|---|---|
| curl | Built-in | Universal, scripting-friendly |
| httpie | pip install httpie | Human-friendly output |
| xh | cargo install xh | Rust version of httpie |
| Language | Framework | Install |
|---|---|---|
| Python | pytest + requests | pip install pytest requests |
| JavaScript | Jest + supertest | npm install --save-dev jest supertest |
| Go | net/http + testing | Built-in |
| Java | JUnit + RestAssured | Maven/Gradle |
# Python example
import requests
def test_get_user():
response = requests.get(f"{BASE_URL}/users/1")
# Status code
assert response.status_code == 200
# Headers
assert "application/json" in response.headers["Content-Type"]
# Schema
data = response.json()
assert "id" in data
assert "name" in data
assert isinstance(data["id"], int)
# Error cases
response = requests.get(f"{BASE_URL}/users/99999")
assert response.status_code == 404
import pytest
import requests
BASE_URL = "https://api.example.com"
class TestUsersAPI:
@pytest.fixture
def auth_headers(self):
return {"Authorization": "Bearer test-token"}
def test_get_users(self, auth_headers):
response = requests.get(f"{BASE_URL}/users", headers=auth_headers)
assert response.status_code == 200
assert isinstance(response.json(), list)
def test_create_user(self, auth_headers):
data = {"name": "Test User", "email": "test@example.com"}
response = requests.post(f"{BASE_URL}/users",
json=data, headers=auth_headers)
assert response.status_code == 201
assert response.json()["name"] == "Test User"
def test_get_user_not_found(self, auth_headers):
response = requests.get(f"{BASE_URL}/users/99999", headers=auth_headers)
assert response.status_code == 404
const request = require('supertest');
const app = require('../app');
describe('Users API', () => {
let authToken;
beforeAll(async () => {
const res = await request(app)
.post('/auth/login')
.send({ username: 'test', password: 'test' });
authToken = res.body.token;
});
test('GET /users returns list', async () => {
const res = await request(app)
.get('/users')
.set('Authorization', `Bearer ${authToken}`);
expect(res.statusCode).toBe(200);
expect(Array.isArray(res.body)).toBe(true);
});
});
Problem: Only checking response body, not status codes
Solution: Always assert status codes first
Problem: Only testing with valid auth, missing auth failure cases
Solution: Add tests for missing/invalid/expired tokens
Problem: Tests fail when data changes
Solution: Use fixtures or factory patterns to generate test data
Problem: Test data accumulates, causing conflicts
Solution: Clean up (delete) created resources in teardown
After setting up API tests:
pytest or npm testpytest --cov