All Projects → olipratt → swagger-conformance

olipratt / swagger-conformance

Licence: MIT License
Python based tool for testing whether your API conforms to its Swagger schema

Programming Languages

python
139335 projects - #7 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to swagger-conformance

Deepstate
A unit test-like interface for fuzzing and symbolic execution
Stars: ✭ 603 (+1082.35%)
Mutual labels:  property-based-testing, fuzzing
Hypothesis
Hypothesis is a powerful, flexible, and easy to use library for property-based testing.
Stars: ✭ 5,571 (+10823.53%)
Mutual labels:  property-based-testing, fuzzing
super-powered-api-testing
Comparisons of powerful API testing tools
Stars: ✭ 25 (-50.98%)
Mutual labels:  swagger, open-api
Schemathesis
A modern API testing tool for web applications built with Open API and GraphQL specifications.
Stars: ✭ 768 (+1405.88%)
Mutual labels:  swagger, property-based-testing
Fuzzcheck Rs
Structure-aware, in-process, coverage-guided, evolutionary fuzzing engine for Rust functions.
Stars: ✭ 247 (+384.31%)
Mutual labels:  property-based-testing, fuzzing
Fast Check
Property based testing framework for JavaScript (like QuickCheck) written in TypeScript
Stars: ✭ 2,604 (+5005.88%)
Mutual labels:  property-based-testing, fuzzing
Jqf
JQF + Zest: Coverage-guided semantic fuzzing for Java.
Stars: ✭ 340 (+566.67%)
Mutual labels:  property-based-testing, fuzzing
Rapid
Rapid is a Go library for property-based testing that supports state machine ("stateful" or "model-based") testing and fully automatic test case minimization ("shrinking")
Stars: ✭ 213 (+317.65%)
Mutual labels:  property-based-testing, fuzzing
swagger-test
Property based testing tool for Swagger APIs
Stars: ✭ 32 (-37.25%)
Mutual labels:  swagger, property-based-testing
fuzz-rest-api
Derive property based testing fast-check into a fuzzer for REST APIs
Stars: ✭ 38 (-25.49%)
Mutual labels:  property-based-testing, fuzzing
VxFuzz
Some VxWorks fuzzing examples using Cisco-Kitty and WDBDbg framework
Stars: ✭ 16 (-68.63%)
Mutual labels:  fuzzing
podpodge
Convert YouTube playlists to audio-only RSS feeds for podcast apps to consume.
Stars: ✭ 32 (-37.25%)
Mutual labels:  swagger
tssg-syntax-parser
Parser to generate AST from TSSG Syntax
Stars: ✭ 17 (-66.67%)
Mutual labels:  swagger
Kodkod
https://github.com/alirizaadiyahsi/Nucleus Web API layered architecture startup template with ASP.NET Core 2.1, EF Core 2.1 and Vue Client
Stars: ✭ 45 (-11.76%)
Mutual labels:  swagger
fixture-monkey
Let Fixture Monkey generate test instances including edge cases automatically
Stars: ✭ 177 (+247.06%)
Mutual labels:  property-based-testing
crusher
No description or website provided.
Stars: ✭ 21 (-58.82%)
Mutual labels:  fuzzing
UltimateCMSWordlists
📚 An ultimate collection wordlists of the best-known CMS
Stars: ✭ 54 (+5.88%)
Mutual labels:  fuzzing
fastify-openapi-glue
A plugin for Fastify to autogenerate a configuration based on a OpenApi(v2/v3) specification.
Stars: ✭ 94 (+84.31%)
Mutual labels:  swagger
KRFAnalysis
Collection of LLVM passes and triage tools for use with the KRF fuzzer
Stars: ✭ 26 (-49.02%)
Mutual labels:  fuzzing
gin-swagger
DRY templates for go-swagger
Stars: ✭ 79 (+54.9%)
Mutual labels:  swagger

swagger-conformance

PyPI version Build Status codecov docs

PyPI Versions PyPI License

You have a Swagger (aka OpenAPI) schema defining an API you provide - but does your API really conform to that schema, and does it correctly handle all valid inputs?

swaggerconformance combines the power of hypothesis for property based / fuzz testing with pyswagger to explore all corners of your API - testing its conformance to its specification.

Purpose

A Swagger/OpenAPI Spec allows you to carefully define what things are and aren't valid for your API to consume and produce. This tool takes that definition, and tries to make requests exploring all parts of the API while strictly adhering to the schema. Its aim is to find any places where your application fails to adhere to its own spec, or even just falls over entirely, so you can fix them up.

This is not a complete fuzz tester of your HTTP interface e.g. sending complete garbage, or to non-existent endpoints, etc. It's aiming to make sure that any valid client, using your API exactly as you specify, can't break it.

Setup

Either install with pip install swagger-conformance, or manually clone this repository and from inside it install dependencies with pip install -r requirements.txt.

Usage

After setup, the simplest test you can run against your API is just the following from the command line:

python -m swaggerconformance 'http://example.com/api/schema.json'

where the URL should resolve to your swagger schema, or it can be a path to the file on disk.

This basic test tries all your API operations looking for errors. For explanation of the results and running more thorough tests, including sequences of API calls and defining your custom data types, see the examples.

Documentation

Full documentation, including the example walkthroughs mentioned above and API documentation, is available here.

Wait, I don't get it, what does this thing do?

In short, it lets you generate example values for parameters to your Swagger API operations, make API requests using these values, and verify the responses.

For example, take the standard petstore API example. At the time of writing, that has an endpoint /pet with a PUT method operation that takes a relatively complicated body parameter.

With just a little code, we can load in the swagger schema for that API, access the operation we care about, and generate example parameters for that operation:

>>> import swaggerconformance
>>>
>>> client = swaggerconformance.client.Client('http://petstore.swagger.io/v2/swagger.json')
>>>
>>> strategy_factory = swaggerconformance.strategies.StrategyFactory()
>>> operation = client.api.endpoints["/pet"]["put"]
>>> strategy = operation.parameters_strategy(strategy_factory)
>>> strategy.example()
{
  'body':{
    'id':110339,
    'name':'\U00052ea5\x9d\ua79d\x92\x13\U000f7c436!\U000aa3c5R\U0005b40e\n',
    'photoUrls':[
      '\ua9d9\U0003fb3a\x13\U00025c1c\U000974a8\u3497\U000515fa\n',
      "\U000b38a4>*\u6683'\U0002cd8f\x0f\n"
    ],
    'status':'sold',
    'category':{
      'id':-22555826027447
    },
    'tags':[
      {
        'id':-172930,
        'name':'\U000286df\u04dc\U00033563\u696d\U00055ba8\x89H'
      }
    ]
  }
}
>>>

See the examples for more details, and how to make requests against an API using these parameter values.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].