Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

schemathesis

БесплатноБез исполняемых скриптовНе проверен

Schemathesis automatically tests APIs by generating test cases from their OpenAPI or GraphQL schemas. Use when tasks involve API fuzzing, finding edge cases…

TerminalSkillsот TerminalSkills★ 221 звезда на GitHub

Об этом скилле

Schemathesis

Overview

Automatically generate and run API tests from OpenAPI and GraphQL schemas. Schemathesis finds bugs by generating thousands of test cases — boundary values, invalid types, malformed payloads, deep nesting — that developers never think to write manually. This skill covers Schemathesis 4 (current: 4.28). Version 4 renamed most of the v3 command line and Python API: --hypothesis-max-examples, --stateful=links, --junit-xml, --cassette-path, --base-url and schemathesis.from_uri no longer exist.

Instructions

Installation

pip install schemathesis          # installs the `schemathesis` command and its alias `st`
uvx schemathesis run http://127.0.0.1:8000/openapi.json   # or run once without installing

The Docker image schemathesis/schemathesis:stable (also on ghcr.io) takes the same arguments after the image name (see CI Integration).

Quick Start

# Test a running API using the schema it serves
st run http://127.0.0.1:8000/openapi.json
# Test from a local schema file (the API address is then required)
st run ./openapi.yaml --url http://127.0.0.1:8000
# Test a GraphQL API
st run http://127.0.0.1:8000/graphql

The exit code is 0 when every check passed, 1 when a check failed or the schema or schemathesis.toml could not be loaded, 2 for a command-line error (unknown option, missing schema file).

How It Works

Schemathesis reads your API schema (OpenAPI 2.0, 3.0, 3.1, 3.2 or GraphQL) and runs four phases in order:

  1. Examples — sends the examples written in the schema (skipped when there are none)
  2. Coverage — deterministic cases for every constraint: boundaries, missing required fields, wrong types, undocumented methods
  3. Fuzzing — random valid and invalid inputs, up to --max-examples per operation (default 100)
  4. Stateful — chains calls (create → read → delete), feeding response data into later requests

Every response goes through all checks (5xx errors, undocumented status codes, response schema violations, accepted invalid input, ignored authentication, and more). A failing case is shrunk to a minimal input and printed with a curl command that reproduces it.

CLI Options

SCHEMA=http://127.0.0.1:8000/openapi.json
# Authentication
st run $SCHEMA --auth "$API_USER:$API_PASSWORD"               # Basic auth
st run $SCHEMA --header "Authorization: Bearer $API_TOKEN"    # Bearer token
st run $SCHEMA --header "X-API-Key: $API_KEY"                 # API key

# Target specific operations (match the path template in the schema, not a real URL)
st run $SCHEMA --include-path /items                 # exact path
st run $SCHEMA --include-path-regex '^/items/'       # regular expression
st run $SCHEMA --include-method POST
st run $SCHEMA --exclude-path '/admin/users' --exclude-deprecated

# Control test volume and scope
st run $SCHEMA --max-examples 500         # -n: test cases per operation
st run $SCHEMA --phases coverage,fuzzing  # choose phases: examples, coverage, fuzzing, stateful
st run $SCHEMA --checks not_a_server_error            # run only these checks
st run $SCHEMA --exclude-checks unsupported_method    # run all but these
st run $SCHEMA --workers 4                # parallel workers (1-64 or auto)
st run $SCHEMA --rate-limit 100/s         # or `auto` to follow Retry-After on 429
st run $SCHEMA --request-timeout 5 --max-response-time 3   # seconds (v3 took milliseconds)
st run $SCHEMA --seed 42                  # repeat a run with the same inputs
st run $SCHEMA --wait-for-schema 30       # wait for the API to come up (CI)

# Output — files land in ./schemathesis-report/ with a timestamp in the name
st run $SCHEMA --report junit,har                    # also: vcr, ndjson, json, allure
st run $SCHEMA --report-junit-path results.xml       # fixed file name
st run $SCHEMA --report-vcr-path cassette.yaml       # every request and response, as YAML

Test Strategies

Negative testing

By default (--mode all) Schemathesis sends both valid inputs and inputs that violate the schema; --mode positive or --mode negative restricts it to one kind. For { "type": "integer", "minimum": 1, "maximum": 100 } it tries 0, 101, null, "string", 1.5, []; for an array with maxItems: 10 it sends 11 items. The negative_data_rejection check fails when the API answers such a request with a success status.

Stateful testing

The stateful phase runs by default; no flag turns it on. Schemathesis infers links between operations from the schema (a POST /items response with an id feeds GET /items/{item_id}), learns from Location headers, and uses explicit OpenAPI links when present.

st run $SCHEMA --phases stateful          # only the chained scenarios
st fuzz $SCHEMA --max-time 600            # continuous multi-step fuzzing, at most 10 minutes

This catches bugs that only appear with real resource IDs. If no operation produces data for another one, the summar

Полный SKILL.md на GitHub

Установить schemathesis в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

_scores.json

FAQ

Что делает скилл schemathesis?

Schemathesis automatically tests APIs by generating test cases from their OpenAPI or GraphQL schemas. Use when tasks involve API fuzzing, finding edge cases in REST or GraphQL APIs, testing schema compliance, generating property-based tests from API specs, finding crashes and 500 errors, or validating API contracts. Schemathesis generates thousands of test cases from the schema and finds bugs that manual testing misses.

Как установить скилл schemathesis?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл schemathesis запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить schemathesis с