Skip to main content

Dead Simple API Unit Tests

Project description

/ma-ji-me/

noun

  1. an earnest, reliable person who can get things done
  2. 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 in a Python3 environment

Or get the binaries for MacOS | Linux | Windows

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


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.8.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

majime-0.0.8-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file majime-0.0.8.tar.gz.

File metadata

  • Download URL: majime-0.0.8.tar.gz
  • Upload date:
  • Size: 4.5 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

Hashes for majime-0.0.8.tar.gz
Algorithm Hash digest
SHA256 6b69198035e481d582166d81c81aa5a52b7acd3dcb432aa90e225a09d00aae74
MD5 fb8be2039480817bc22f6c06d83c52b7
BLAKE2b-256 955ac97f555dc54cfc5e6bab0c0216ea292cc1f242fc0dc76c82a4df085f469d

See more details on using hashes here.

File details

Details for the file majime-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: majime-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 5.1 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

Hashes for majime-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 e39ad6dab2c41bb57d2851f239428a0734d205631eb4145a8602130d51ca0238
MD5 0d4c6b0ab091744d285e284f80cd18cf
BLAKE2b-256 358a5d0071d2fe1537cccb8b53ebd2f6a1a385ea63963306edcc0c6f19a7f0ea

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page