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.8.tar.gz (21.2 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.8-py2.py3-none-any.whl (17.5 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

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

File hashes

Hashes for yapitest-0.0.8.tar.gz
Algorithm Hash digest
SHA256 7ff0b354fca4113a72628caeeb87df159d4fba0f43be7c9edf76178400b27ba5
MD5 b35cd8c01674e088059a7a557c0801c4
BLAKE2b-256 4caf97a6838dfb74954f6bf9d90d1724a468338e559f4b0fef954106b932cb99

See more details on using hashes here.

File details

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

File metadata

  • Download URL: yapitest-0.0.8-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.32.5

File hashes

Hashes for yapitest-0.0.8-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 72cdb9a022b4c41f9da6b2c472b1b85cf383758926894cbfac6cece12aa2024b
MD5 1879f5be9c39052aed7d6fd0a2d290f0
BLAKE2b-256 3821966cd006a43ddd72208828b0e5afe4d7332fd7e12e1578a9e8c8b13917da

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