Skip to main content

Yaml based API testing framework

Project description

Yapitest

Yapitest (Yaml API Testing) is an API testing framework composed entirely of YAML files. Testing is frustrating enough already, and Yapitest aims to simplify the entire process of API testing through a simple interface. Frankly, the entire expect(value).toBe(0) stuff keeps me up at night.

Table of Contents

Disclaimer

Yapitest is still in alpha and there may be some bugs. Feel free to open up a Pull Request or submit an issue and I will try to get it tested and merged as quickly as possible.

Example

The yapitest test format was designed to be as simple as possible. Even if you have never seen a yapitest test before, you can probably infer all of what the test is doing.

Here is an example:

test-create-and-get-post:
  setup: create-user
  steps:
    - path: /api/post/create
      id: create-post
      method: POST
      headers:
        API-Token: $setup.token
      data:
        title: Some Title
        body: Some message
      assert:
        status-code: 201
    - path: /api/post/$create-post.response.post_id
      assert:
        body:
          title: "Some Title"
          body: "Some message"
  1. Firstly, the name of the test (test-create-and-get-post) gives some indication of what the test is doing.

  2. There is a setup which is something that runs before the test. This one, create-user is reusable step that creates a user. It is defined in a config file. Similarly, you can specify a cleanup which is run after the other steps run.

  3. Then we have the steps section, which includes the actual steps of the tests.

  4. The first step sends a POST request to /api/post/create, with a title and body in the payload, utilizing an API Token that the setup generated. Then asserts that the status code is 201.

  5. The last step of the test sends a GET request to /api/post/$create-post.response.post_id. This $create-post.response.post_id referse to the json response of the $create-post step which has a key post_id in it. Then inside of the assert block we ensure that the data in the body contains the proper title and body values.

For more information about how to format your tests, please refer to Tests.md.

Installation

To install, run:

pip install yapitest

Then you can run it via yapitest in your terminal.

Further Documentation

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

yapitest-0.0.7.tar.gz (21.0 kB view details)

Uploaded Source

Built Distribution

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

yapitest-0.0.7-py2.py3-none-any.whl (17.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file yapitest-0.0.7.tar.gz.

File metadata

  • Download URL: yapitest-0.0.7.tar.gz
  • Upload date:
  • Size: 21.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for yapitest-0.0.7.tar.gz
Algorithm Hash digest
SHA256 08d8fa644defb6a710da29b2845d61ab1c090058509c0a43c0bcdf6e79c8c65a
MD5 a66994668907b8eb5f619089ebf006a4
BLAKE2b-256 3a9a2c7796fbc2bdab981c1562ab31fd637cb36cd30c5d86605d5ddb30a845ea

See more details on using hashes here.

File details

Details for the file yapitest-0.0.7-py2.py3-none-any.whl.

File metadata

  • Download URL: yapitest-0.0.7-py2.py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for yapitest-0.0.7-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 339464879da7821124d6640104327c602844ac1ebdb4d70b146a83d17efbb2b7
MD5 f606acdffb6955a73f1c8220fdf263bb
BLAKE2b-256 76c80249f1d3db12700cca18c75211d6fb64c81f578b7c431f212eab3f9ec4ef

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