A command-line tool for HTTP tests over RESTful APIs
Project description
Pissed about writing test scripts against your RESTFul APIs anytime?
Describe an HTTP Requests test cases in a simplest and widely used format JSON within a file.
Run one command and gain a summary report.
📣
📣 Coverage measuring on Test Cases coming soon
📣
Installation
Recommended installation method is to use pip:
$ pip install pyhttptest
Python version 3+ is required.
Usage
$ pyhttptest execute FILE
See also pyhttptest --help.
Examples
Single test case
Create a .json file and define a test case like an example:
FILE: HTTP_GET.json
{
"name": "TEST: List all users",
"verb": "GET",
"endpoint": "users",
"host": "https://github.com",
"headers": {
"Accept-Language": "en-US"
},
"query_string": {
"limit": 5
}
}
Execute a test case:
$ pyhttptest execute FILE_PATH/HTTP_GET.json
Result:
Мultiple test cases
Create a .json file and define a test cases like an example:
FILE: requests.json
[
{
"name":"TEST: List all users",
"verb":"GET",
"endpoint":"api/v1/users",
"host":"http://localhost:8085/",
"headers":{
"Accept-Language":"en-US"
},
"query_string":{
"limit":1
}
},
{
"name":"TEST: Add a new user",
"verb":"POST",
"endpoint":"api/v1/users",
"host":"http://localhost:8085/",
"payload":{
"username":"pyhttptest",
"email":"admin@pyhttptest.com"
}
},
{
"name":"TEST: Modify an existing user",
"verb":"PUT",
"endpoint":"api/v1/users/XeEsscGqweEttXsgY",
"host":"http://localhost:8085/",
"payload":{
"username":"pyhttptest"
}
},
{
"name":"TEST: Delete an existing user",
"verb":"DELETE",
"endpoint":"api/v1/users/XeEsscGqweEttXsgY",
"host":"http://localhost:8085/"
}
]
Execute a test case:
$ pyhttptest execute FILE_PATH/requests.json
Result:
Dependencies
Under the hood, pyhttptest uses these amazing libraries:
ijson — Iterative JSON parser with a standard Python iterator interface
jsonschema — An implementation of JSON Schema validation for Python
Requests — Python HTTP library for humans
tabulate — Pretty-print tabular data
click — Composable command line interface toolkit
Contributing
See CONTRIBUTING.
Changelog
See CHANGELOG.
Licence
BSD-3-Clause: LICENSE.
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file pyhttptest-0.7.tar.gz
.
File metadata
- Download URL: pyhttptest-0.7.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae8620241d872cffd4c99c7ce4bfea65c1ad529eb3addf591b696c082fa997d5 |
|
MD5 | adbf16445c89063f71369247dbb1ea87 |
|
BLAKE2b-256 | 2a55c0bdc4e1dd20c76834ea21c00b4a1503e03f02e5b55a1f5b4041a9085c2e |
File details
Details for the file pyhttptest-0.7-py3-none-any.whl
.
File metadata
- Download URL: pyhttptest-0.7-py3-none-any.whl
- Upload date:
- Size: 15.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f32edcdd721cd70ca3fb499caf74e47241693f872d22b9bcfaaf7470522ac1e0 |
|
MD5 | 34e2c226e0637cdc247a7d940390ffdf |
|
BLAKE2b-256 | 94556ff5d9caf27eb2a4a7d3924c0140fc85829c7c65e439719e07abb60dfc56 |