Skip to main content

Automated Testing and Documentation for your REST API

Project description

CircleCI Codecov PyPI version Join the community on Spectrum

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/ # The API's base url
    requests:
      - name: list_all_devs # The name of the first request
        path: devs/ # 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. A screenshot of the report showing the response and test details

Documentation

The full documentation is available at scanapi.dev

Examples

You can find complete examples at scanapi/examples!

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.

Files for scanapi, version 2.1.0
Filename, size File type Python version Upload date Hashes
Filename, size scanapi-2.1.0-py3-none-any.whl (24.1 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size scanapi-2.1.0.tar.gz (19.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page