Dead Simple API Unit Tests
Project description
/ma-ji-me/
noun
- an earnest, reliable person who can get things done
- dead simple API Unit Testing
What does it do?
- majime runs test cases on API endpoints
- test cases are defined in YAML files
- majime can generate test cases from Swagger specs
Install
pip install majime
Use a Python3 environment | Package on Pypi
Usage
Usage:
-f Load and run tests from YAML file
Example: majime -f test.yaml
-g Generate test suite (YAML) from Swagger document
Example: majime -g http://api.example.com/swagger.json
Switches:
-s No output, just response code
-j JSON output
-d Dry-Run, do not execute tests - good for testing your YAML file
-n no colors in output
-c do not stop on the first error
Example
Generate Test Cases from Swagger
majime -g http://backend.yoisho.dob.jp/fx/swagger
Title: Yoisho Currency Exchange
Host: backend.yoisho.dob.jp
Base Path: /fx
Scheme: http
Path: /currency
Method: GET
Description: Get the FX rate for desired currency
Query Parameters: ['currency']
Expected Response: 200
Generated Output File
Base: "http://backend.yoisho.dob.jp/fx"
Tests:
# GET - Get the FX rate for desired currency
- path: "/currency?currency=USD"
method: "GET"
headers: ""
expect-response: "200"
expect-body: "json"
Run Test Cases
Modify the parameters so they make sense, in this case XXX-> USD.
majime -f Yoisho_Currency_Exchange-*.yaml
GET http://backend.yoisho.dob.jp/fx/currency?currency=USD
HTTP 200
Check out the examples.
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
majime-0.0.6.tar.gz
(4.2 kB
view details)
Built Distribution
File details
Details for the file majime-0.0.6.tar.gz
.
File metadata
- Download URL: majime-0.0.6.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dddd72f817be5c37dce28262d0513142aa99fffb9659238a8232604d7243558a |
|
MD5 | bdf8b7417c6c7f18864195678af5774d |
|
BLAKE2b-256 | 86580170166f44485256528aaa381f3f3e276481c6ac39fe94c602b2622c3628 |
File details
Details for the file majime-0.0.6-py3-none-any.whl
.
File metadata
- Download URL: majime-0.0.6-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f77bf9e6da49feb97e0312292561e14ed9aa6410d72c1e683e6f52091934649 |
|
MD5 | a214ce16f85afc27a3469b98ec7f27ea |
|
BLAKE2b-256 | 35b10ccb1b722f3132cd7bb6890a6cbca9a56239a819a57dabcb1feee184de5a |