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"
-
Firstly, the name of the test (
test-create-and-get-post) gives some indication of what the test is doing. -
There is a
setupwhich is something that runs before the test. This one,create-useris reusable step that creates a user. It is defined in a config file. Similarly, you can specify acleanupwhich is run after the other steps run. -
Then we have the
stepssection, which includes the actual steps of the tests. -
The first step sends a
POSTrequest to/api/post/create, with atitleandbodyin the payload, utilizing an API Token that thesetupgenerated. Then asserts that the status code is201. -
The last step of the test sends a
GETrequest to/api/post/$create-post.response.post_id. This$create-post.response.post_idreferse to the json response of the$create-poststep which has a keypost_idin it. Then inside of theassertblock we ensure that the data in the body contains the propertitleandbodyvalues.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ff0b354fca4113a72628caeeb87df159d4fba0f43be7c9edf76178400b27ba5
|
|
| MD5 |
b35cd8c01674e088059a7a557c0801c4
|
|
| BLAKE2b-256 |
4caf97a6838dfb74954f6bf9d90d1724a468338e559f4b0fef954106b932cb99
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72cdb9a022b4c41f9da6b2c472b1b85cf383758926894cbfac6cece12aa2024b
|
|
| MD5 |
1879f5be9c39052aed7d6fd0a2d290f0
|
|
| BLAKE2b-256 |
3821966cd006a43ddd72208828b0e5afe4d7332fd7e12e1578a9e8c8b13917da
|