Skip to main content

Automated Testing and Documentation for your REST API

Project description

Codecov CircleCI LintCheck Examples Downloads Per Month PyPI version Discord

A library for your API that provides:

  • Automated Integration Testing
  • Automated Live Documentation

Given an API specification, written in YAML/JSON format, ScanAPI hits the specified endpoints, runs the test cases, and generates a detailed report of this execution - which can also be used as the API documentation itself.

With almost no Python knowledge, the user can define endpoints to be hit, the expected behavior for each response and will receive a full real-time diagnostic report of the API!

Contents

Requirements

How to install

$ pip install scanapi

Basic Usage

You will need to write the API's specification and save it as a YAML or JSON file. For example:

endpoints:
  - name: scanapi-demo # The API's name of your API
    path: http://demo.scanapi.dev/api/v1 # The API's base url
    requests:
      - name: list_all_users # The name of the first request
        path: users/ # The path of the first request
        method: get # The HTTP method of the first request
        tests:
          - name: status_code_is_200 # The name of the first test for this request
            assert: ${{ response.status_code == 200 }} # The assertion

And run the scanapi command

$ scanapi run <file_path>

Then, the lib will hit the specified endpoints and generate a scanapi-report.html file with the report results.

An overview screenshot of the report. A screenshot of the report showing the request details.

Documentation

The full documentation is available at scanapi.dev

Examples

You can find complete examples at scanapi/examples!

This tutorial helps you to create integration tests for your REST API using ScanAPI

Watch the video

Contributing

Collaboration is super welcome! We prepared the Newcomers Guide to help you in the first steps. Every little bit of help counts! Feel free to create new GitHub issues and interact here.

Let's build it together 🚀🚀

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scanapi-2.12.0.tar.gz (25.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scanapi-2.12.0-py3-none-any.whl (31.2 kB view details)

Uploaded Python 3

File details

Details for the file scanapi-2.12.0.tar.gz.

File metadata

  • Download URL: scanapi-2.12.0.tar.gz
  • Upload date:
  • Size: 25.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.3 Linux/6.11.0-1015-azure

File hashes

Hashes for scanapi-2.12.0.tar.gz
Algorithm Hash digest
SHA256 fd488a9f9eaed51c0999c7f2d54649507786172fbb053b347b4e4c465937f1d8
MD5 380214fcdc05c882b64bea0e56db0304
BLAKE2b-256 900e6b843330f57436d4d7e5cfe6af27ef64a0bb8bb6f173cf55e66d6cdbb2d3

See more details on using hashes here.

File details

Details for the file scanapi-2.12.0-py3-none-any.whl.

File metadata

  • Download URL: scanapi-2.12.0-py3-none-any.whl
  • Upload date:
  • Size: 31.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.3 Linux/6.11.0-1015-azure

File hashes

Hashes for scanapi-2.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5aa0e644c2037965c4c0c1db884bf4fc02078acb51c065700785de25557b5399
MD5 b7e9b897bbc23ea0fbe0c54a532f324c
BLAKE2b-256 e74beb8cb51181b03e08bee28af10116acfd126602afcb44f0429fe05a3f3247

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page