api-evangelist/schemathesis

GitHub: api-evangelist/schemathesis

Schemathesis 是一款基于属性的API测试工具,能自动从OpenAPI和GraphQL模式生成测试用例以发现规范违规和漏洞。

Stars: 0 | Forks: 0

# Schemathesis Schemathesis 是一款基于属性的 API 测试工具,它能从 OpenAPI 和 GraphQL 模式自动生成测试用例,以发现漏洞和规范违规。它使用 Hypothesis 基于属性的测试框架,根据模式约束生成多样化的、覆盖边缘情况的测试输入,从而检测服务器崩溃、响应模式违规、验证绕过以及多步骤工作流中的状态性问题。 被 Netflix、SAP、Red Hat、IBM 和 JetBrains 等公司使用。 **官方网站:**[https://schemathesis.io](https://schemathesis.io) ## 资源 - [文档](https://schemathesis.readthedocs.io) - [快速入门](https://schemathesis.readthedocs.io/en/stable/getting-started.html) - [GitHub 仓库](https://github.com/schemathesis/schemathesis) - [PyPI 包](https://pypi.org/project/schemathesis/) - [Docker 镜像](https://hub.docker.com/r/schemathesis/schemathesis) - [GitHub Action](https://github.com/schemathesis/action) - [更新日志](https://github.com/schemathesis/schemathesis/releases) - [博客](https://schemathesis.io/blog) - [研究论文 (ACM)](https://dl.acm.org/doi/10.1145/3510003.3510097) ## 功能特性 - **基于属性的测试** — 根据模式类型约束、格式规则、枚举和模式自动生成数千个测试用例 - **模式驱动的模糊测试** — 输入受模式定义约束,进行有针对性、有意义的模糊测试 - **响应验证** — 检查状态码、响应体、内容类型和头信息是否符合 OpenAPI 声明 - **状态性测试** — 遵循 OpenAPI Links 生成多步骤工作流测试 - **自动缩减** — 将失败用例最小化到最小的可重现 curl 命令 - **原生 CI/CD 集成** — 支持 GitHub Actions (`schemathesis/action@v2`)、GitLab CI、pytest 集成 ## 支持的规范 - OpenAPI 2.0 (Swagger)、3.0.x、3.1.x - GraphQL 模式 (SDL 和 introspection) ## 安装 ``` pip install schemathesis # 或 uvx schemathesis run schema.json --url https://api.example.com ``` ## 产出物 ### JSON 模式 - [schemathesis-config-schema.json](json-schema/schemathesis-config-schema.json) — Schemathesis 配置的 JSON Schema ### JSON 结构 - [schemathesis-config-structure.json](json-structure/schemathesis-config-structure.json) — .schemathesis.yml 的文档结构 ### JSON-LD - [schemathesis-context.jsonld](json-ld/schemathesis-context.jsonld) — Schemathesis 词汇表的链接数据上下文 ### 示例 - [schemathesis-cli-test-example.json](examples/schemathesis-cli-test-example.json) — CLI 测试运行输出示例 ### 词汇表 - [schemathesis-vocabulary.yml](vocabulary/schemathesis-vocabulary.yml) — Schemathesis 概念的领域词汇表 ## 维护者 **Kin Lane** — kin@apievangelist.com
标签:API测试, API规范, bug检测, GraphQL, Hypothesis框架, OpenAPI, pocsuite3, 响应验证, 多步骤工作流, 安全测试, 安全规则引擎, 属性测试, 攻击性安全, 测试用例生成, 状态测试, 规范验证, 请求拦截, 质量保证, 软件测试, 边缘案例测试, 逆向工具