项目作者: scanapi

项目描述 :
Automated Integration Testing and Live Documentation for your API
高级语言: Python
项目地址: git://github.com/scanapi/scanapi.git
创建时间: 2019-07-20T10:31:47Z
项目社区:https://github.com/scanapi/scanapi

开源协议:MIT License

下载




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

  1. $ 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:

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

And run the scanapi command

  1. $ 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 🚀🚀