Tavern API Testing¶
Tavern is an advanced pytest based API testing framework for HTTP, MQTT or other protocols.
Note that Tavern only supports Python 3.4 and up. At the time of writing we test against Python 3.7-3.9 and pypy3. Python 2 is now unsupported.
Choosing an API testing framework can be tough. Tavern was started in 2017 to address some of our concerns with other testing frameworks.
In short, we think the best things about Tavern are:
Tavern is a small codebase which uses pytest under the hood.
Easy to Write, Easy to Read and Understand.¶
The yaml syntax allows you to abstract what you need with anchors, whilst using
pytest.mark to organise your tests. Your tests should become more maintainable as a result.
From the simplest API test through to the most complex of requests, tavern remains readable and easy to extend. We’re aiming for developers to not need the docs open all the time!
Almost all common test usecases are covered, but for everything else it’s very easy to drop in to python/pytest to extend. Use fixtures, hooks and things you already know.
Tavern is still in active development and is used by 100s of companies.