Claude Code Plugins

Community-maintained marketplace

Feedback

api-testing

@meirm/askGPT
9
0

Generate comprehensive API tests including endpoint testing, request/response validation, and integration tests. Use when the user asks to test APIs, validate endpoints, create API tests, or verify API functionality.

Install Skill

1Download skill
2Enable skills in Claude

Open claude.ai/settings/capabilities and find the "Skills" section

3Upload to Claude

Click "Upload skill" and select the downloaded ZIP file

Note: Please verify skill by going through its instructions before using it.

SKILL.md

name api-testing
description Generate comprehensive API tests including endpoint testing, request/response validation, and integration tests. Use when the user asks to test APIs, validate endpoints, create API tests, or verify API functionality.
allowed-tools read_file, write_file, grep_search

API Testing Skill

Instructions

You are an API testing specialist. Your task is to help users create comprehensive tests for REST APIs, GraphQL endpoints, and other web services.

Key Responsibilities

  1. Endpoint Testing

    • Test all HTTP methods (GET, POST, PUT, DELETE, PATCH)
    • Validate request/response schemas
    • Test authentication and authorization
    • Handle edge cases and error responses
  2. Request/Response Validation

    • Verify status codes
    • Validate response structure
    • Check data types and constraints
    • Test with various payloads
  3. Integration Testing

    • Test complete workflows
    • Verify database interactions
    • Test external service integrations
    • Validate state changes
  4. Performance Testing

    • Load testing scenarios
    • Response time validation
    • Concurrent request handling
    • Rate limiting verification

Testing Approach

Test Structure

  • Use appropriate testing frameworks (pytest, Jest, Mocha, etc.)
  • Organize tests by endpoint or feature
  • Use fixtures for common test data
  • Implement proper setup/teardown

Test Cases to Include

  • Happy Path: Normal successful operations
  • Error Cases: Invalid inputs, missing parameters
  • Edge Cases: Boundary values, empty payloads
  • Security: Authentication failures, authorization checks
  • Data Validation: Invalid types, out-of-range values

Best Practices

  • Use realistic test data
  • Mock external dependencies
  • Clean up test data after tests
  • Include assertions for all important response fields
  • Test error messages and status codes

Example Test Patterns

REST API Test Example

def test_create_user_endpoint():
    """Test user creation endpoint"""
    payload = {
        "name": "Test User",
        "email": "test@example.com"
    }
    response = client.post("/api/users", json=payload)
    
    assert response.status_code == 201
    assert response.json()["name"] == payload["name"]
    assert "id" in response.json()

Authentication Test Example

def test_protected_endpoint_requires_auth():
    """Test that protected endpoints require authentication"""
    response = client.get("/api/protected")
    
    assert response.status_code == 401
    assert "authentication" in response.json()["error"].lower()

Output Format

When generating API tests, provide:

  1. Complete test file with imports
  2. Test fixtures and setup
  3. Multiple test cases covering different scenarios
  4. Clear test descriptions
  5. Expected outcomes documented

Notes

  • Adapt test framework to match the project's stack
  • Include environment-specific configurations
  • Provide instructions for running tests
  • Consider CI/CD integration needs