Skip to main content

pyhttptest: HTTP tests over RESTful APIs✨

https://travis-ci.org/slaily/pyhttptest.svg?branch=master

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

📣

pyhttptest in the command line

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:

pyhttptest in the command line

М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:

pyhttptest in the command line

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.

Authors

Iliyan Slavov

Metadata

Release files for pyhttptest 0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyhttptest 0.7
File Size Uploaded
pyhttptest-0.7.tar.gz 11.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyhttptest 0.7
File Interpreter ABI Platform
pyhttptest-0.7-py3-none-any.whl Python 3 none any Details

Total release size: 27.3 kB

Release files / pyhttptest-0.7.tar.gz

Download URL pyhttptest-0.7.tar.gz
Size 11.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ae8620241d872cffd4c99c7ce4bfea65c1ad529eb3addf591b696c082fa997d5
BLAKE2b-256 checksum
How to use checksums
2a55c0bdc4e1dd20c76834ea21c00b4a1503e03f02e5b55a1f5b4041a9085c2e
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / pyhttptest-0.7-py3-none-any.whl

Download URL pyhttptest-0.7-py3-none-any.whl
Size 15.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f32edcdd721cd70ca3fb499caf74e47241693f872d22b9bcfaaf7470522ac1e0
BLAKE2b-256 checksum
How to use checksums
94556ff5d9caf27eb2a4a7d3924c0140fc85829c7c65e439719e07abb60dfc56
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.7 This release

2 release files

0.6

1 release file

0.5

2 release files

0.4

2 release files

0.3

2 release files

0.2

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page