• Stars
    star
    148
  • Rank 249,983 (Top 5 %)
  • Language
    Python
  • License
    Other
  • Created almost 10 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Declarative HTTP Testing for Python and anything else
Documentation Status

Gabbi

Release Notes

Gabbi is a tool for running HTTP tests where requests and responses are represented in a declarative YAML-based form. The simplest test looks like this:

tests:
- name: A test
  GET: /api/resources/id

See the docs for more details on the many features and formats for setting request headers and bodies and evaluating responses.

Gabbi is tested with Python 3.6, 3.7, 3.8, 3.9, 3.10 and pypy3.

Tests can be run using unittest style test runners, pytest or from the command line with a gabbi-run script.

There is a gabbi-demo repository which provides a tutorial via its commit history. The demo builds a simple API using gabbi to facilitate test driven development.

Purpose

Gabbi works to bridge the gap between human readable YAML files that represent HTTP requests and expected responses and the obscured realm of Python-based, object-oriented unit tests in the style of the unittest module and its derivatives.

Each YAML file represents an ordered list of HTTP requests along with the expected responses. This allows a single file to represent a process in the API being tested. For example:

  • Create a resource.
  • Retrieve a resource.
  • Delete a resource.
  • Retrieve a resource again to confirm it is gone.

At the same time it is still possible to ask gabbi to run just one request. If it is in a sequence of tests, those tests prior to it in the YAML file will be run (in order). In any single process any test will only be run once. Concurrency is handled such that one file runs in one process.

These features mean that it is possible to create tests that are useful for both humans (as tools for improving and developing APIs) and automated CI systems.

Testing and Developing Gabbi

To get started, after cloning the repository, you should install the development dependencies:

$ pip install -r requirements-dev.txt

If you prefer to keep things isolated you can create a virtual environment:

$ virtualenv gabbi-venv
$ . gabbi-venv/bin/activate
$ pip install -r requirements-dev.txt

Gabbi is set up to be developed and tested using tox (installed via requirements-dev.txt). To run the built-in tests (the YAML files are in the directories gabbi/tests/gabbits_* and loaded by the file gabbi/test_*.py), you call tox:

tox -epep8,py37

If you have the dependencies installed (or a warmed up virtualenv) you can run the tests by hand and exit on the first failure:

python -m subunit.run discover -f gabbi | subunit2pyunit

Testing can be limited to individual modules by specifying them after the tox invocation:

tox -epep8,py37 -- test_driver test_handlers

If you wish to avoid running tests that connect to internet hosts, set GABBI_SKIP_NETWORK to True.

More Repositories

1

paste

Python Paste (core) repository
Python
53
star
2

wsgi-intercept

Intercept socket connection to wsgi applications for testing
Python
42
star
3

pastescript

a pluggable command-line tool for paste
Python
13
star
4

tank

Tiddlers Are N[eo][tw] Knowledge
JavaScript
12
star
5

py-ostatus

experimenting with ostatus in python, based on node-ostatus
Python
11
star
6

etcd-compute

A toy placement+etcd vm placer and booter
Python
8
star
7

tiddlyhoster

TiddlyWeb tools for hosting TiddlyWikis
Python
8
star
8

tapas

a dashboard of little bits of info on tiddlyspace
JavaScript
5
star
9

tiddlynode

TiddlyWeb + Node.js
JavaScript
5
star
10

raamable

Playing with maps for RAAM
JavaScript
4
star
11

edit

A bad but ironic name for an editor of TiddlySpace
JavaScript
4
star
12

st-clients

Socialtext Client Tools - REST and SOAP libraries and tools
JavaScript
4
star
13

tsapp

Collection of tools for making client side apps for TiddlySpace more easily.
Python
4
star
14

xmobile-test

Mockup of some xmobile-stuff
Python
3
star
15

gabbi-demo

A demo and tutorial of gabbi in one repo
Python
3
star
16

wikidatamatcher

A hack to play with http://wiki-data.com data
JavaScript
3
star
17

tiddlytoys

My own messing with various things TiddlyWiki and TiddlyWeb
JavaScript
3
star
18

tw5ikifier

TiddlyWiki text wikifier for TiddlySpace,Web based on TiddlyWiki 5
JavaScript
3
star
19

manifestopheles

A manifesto contextualizer.
Python
2
star
20

lazytiddlers

Experiments with laziness for tiddlyweb generated tiddlywikis
JavaScript
2
star
21

spat

A sort of single page application for accessing tiddlers.
JavaScript
2
star
22

vds

Playing with multi-node devstack
Shell
2
star
23

purpler

Stuff for purpling things and then transcluding them.
Python
2
star
24

twebjs

TiddlyWeb client in node.js using TiddlyWiki store interface
JavaScript
2
star
25

tiddlywebplugins.cors

Experiment in handing CORS preflight for TiddlyWeb
Python
2
star
26

tsapp-space

A collection of information about tsapp created with tsapp
JavaScript
2
star
27

twikrad

A hacked up copy of socialtext wikrad
Perl
2
star
28

inveniam

find nearest neighbor in multi dimensional space
Python
2
star
29

sensus

css chrome for looking at recent tiddlers on tiddlyspace
JavaScript
2
star
30

purple

HTTP Interface to generating purple number identifiers and associating them with URLs
Perl
2
star
31

tsapp-todoer

todo app created with tsapp to find bugs and flesh out purpose
JavaScript
2
star
32

atbox

Keep track of @tagged tiddlers in TiddlySpace
JavaScript
2
star
33

twexplorer

single page app to explore tiddlyweb HTTP API
JavaScript
2
star
34

bzhl7

xenBlue HL7 work
Perl
2
star
35

show

simple readonly frontpage to tiddlyspace
JavaScript
2
star
36

gobbi

Gabbi in go
Go
2
star
37

placeload

Exploring some tools to place load on an OpenStack placement service
Python
2
star
38

motus

drag and drag tiddlers between bags in tiddlyweb
JavaScript
2
star
39

chromatazoa

Simple demonstration of using impress.js with TiddlySpace
JavaScript
1
star
40

twebwiki-openshift

TiddlyWebWiki on OpenShift
Python
1
star
41

cdent.github.com

cdent github page
JavaScript
1
star
42

tiddlywebredis

Redis-based store for TiddlyWeb
Python
1
star
43

tiddlywebplugins.fastly

TiddlyWeb Plugin for using Fastly as a dynamic caching accelerator
Python
1
star
44

PythonHAL

Simplistic HAL in JSON composer and consumer for Python
Python
1
star
45

tweb-filters

Tutorial Code for TiddlyWeb Filters
Python
1
star
46

tiddlywebplugins.privateer

Unauthed access to private resources in tiddlyweb
Python
1
star
47

comd

Simple tool to send a twitter direct message
Python
1
star
48

tiddlywebplugins.multirender

Per request dispatch for wikitext rendering in TiddlyWeb
Python
1
star
49

otw

online tiddlywiki customized for tiddlyweb
Python
1
star
50

nitor

climbing routes database and webservice over tiddlyweb
Python
1
star
51

lazytiddlywebwiki

Plugin(s) to make tiddlywebwiki a bit more lazy in it is loading
Python
1
star
52

fnt

f* networked tiddlers for tiddlyweb
JavaScript
1
star
53

placedock

Messing around with openstack placement in docker and kubernetes, probably not for real use.
Dockerfile
1
star
54

tankdock

Tank in Docker
Python
1
star
55

renoder

Nodal document thing.
Go
1
star
56

tiddlywebplugins.atombag

Include an atom feed a tiddlyweb remote bag
Python
1
star
57

tiddlybeaker

TiddlyWeb as Framework. Maybe. But probably not.
Python
1
star
58

gabbi-tempest

A tempest plugin for using gabbi
Python
1
star
59

tiddlywebplugins.patch

HTTP PATCH for TiddlyWeb
Python
1
star
60

tankbookmarker

a tsapp for tank that does bookmarking
CSS
1
star
61

tiddlywebplugins.relativetime

Use relative time indicators in tiddlyweb select filters
Python
1
star