Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/slaily/pyhttptest
A command-line tool for HTTP tests over RESTful APIs✨
https://github.com/slaily/pyhttptest
Last synced: 12 days ago
JSON representation
A command-line tool for HTTP tests over RESTful APIs✨
- Host: GitHub
- URL: https://github.com/slaily/pyhttptest
- Owner: slaily
- License: bsd-3-clause
- Created: 2019-08-08T13:08:49.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T09:31:28.000Z (almost 2 years ago)
- Last Synced: 2024-10-01T15:18:08.086Z (about 1 month ago)
- Language: Python
- Homepage:
- Size: 143 KB
- Stars: 135
- Watchers: 9
- Forks: 11
- Open Issues: 4
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.rst
- Contributing: CONTRIBUTING.rst
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
pyhttptest: HTTP tests over RESTful APIs✨
##########################################.. image:: https://travis-ci.org/slaily/pyhttptest.svg?branch=master
:target: https://travis-ci.org/slaily/pyhttptestPissed 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.
**WARNING⚠️**
The project is in search of any kind of contributor. Due to my commitment to managing many other projects, still **pyhttptest** lacking introducing features requested from users. The project has a lot of potentials to be useful and used on a daily basis. Glad to receive any help and discuss the future of **pyhttptest**. Contact me by email: **[email protected]**.📣 **Coverage measuring on Test Cases coming soon**
.. image:: https://www.dropbox.com/s/cd0g07dop4j1riq/pyhttptest-cli-table-of-results.png?raw=1
:alt: pyhttptest in the command line
:width: 100%
:align: centerInstallation
******************************************Recommended installation method is to use ``pip``:
.. code-block:: bash
$ pip install pyhttptest
Python version **3+** is required.
Usage
******************************************.. code-block:: bash
$ 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``
.. code-block:: 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:
.. code-block:: bash
$ pyhttptest execute FILE_PATH/HTTP_GET.json
Result:
.. image:: https://www.dropbox.com/s/0h56p3c4jm4sriy/pyhttptest-cli.png?raw=1
:alt: pyhttptest in the command line
:width: 100%
:align: centerМultiple test cases
------------------------------------------Create a .json file and define a test cases like an example:
``FILE: requests.json``
.. code-block:: 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":"[email protected]"
}
},
{
"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:
.. code-block:: bash
$ pyhttptest execute FILE_PATH/requests.json
Result:
.. image:: https://www.dropbox.com/s/cd0g07dop4j1riq/pyhttptest-cli-table-of-results.png?raw=1
:alt: pyhttptest in the command line
:width: 100%
:align: centerDependencies
******************************************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 toolkitContributing
******************************************See `CONTRIBUTING `_.
Changelog
******************************************See `CHANGELOG `_.
Licence
******************************************BSD-3-Clause: `LICENSE `_.
Authors
******************************************`Iliyan Slavov`_
.. _Iliyan Slavov: https://www.linkedin.com/in/iliyan-slavov-03478a157/