awesome-python-testing
Collection of awesome 😎️ Python resources for testing
https://github.com/cleder/awesome-python-testing
Last synced: about 9 hours ago
JSON representation
-
Assertions
- believe - A python package for json/dictionary validation.
- easycheck - A collection of assertion-like functions to be used in code, where assertion themselves should be avoided; `easycheck` includes also function aliases to be used in unit testing.
- expects - Expects is an expressive and extensible TDD/BDD assertion library for Python.
- expycted - Another Python expect pattern implementation. Simple, intuitive and approachable, with ability to plug in to any testing framework that relies on assertions.
- dirty-equals - A python library that (mis)uses the `__eq__` method to make python code (generally unit tests) more declarative and therefore easier to read and write.
- Precisely - Write precise assertions so you only test the behaviour you're really interested in.
- PyHamcrest - A framework for writing matcher objects, allowing you to declaratively define "match" rules.
- pytest_cache_assert - Cache assertion data to simplify regression testing of complex serializable data.
- sure - An idiomatic assertion toolkit with human-friendly failure messages, inspired by RSpec Expectations and should.js.
-
Behavior-driven Development
- behave - is behavior-driven development, Python style.
- lettuce - Behavior-driven-development tool for python, inspired by Cucumber for Ruby.
- pytest-pyspec - Transforms pytest output into a beautiful, readable format similar to RSpec. It provides semantic meaning to your tests by organizing them into descriptive hierarchies.
- mamba - The definitive testing tool for Python. Born under the banner of BDD.
-
Code Coverage
- coverage-conditional-plugin - Conditional coverage based on any rules you define.
- diff_cover - Automatically find diff lines that need test coverage.
- Coverage.py - is a tool for measuring code coverage of Python programs.
-
Design by Contract
- deal - Design by contract for Python with static checker and test generation.
- icontract - Design-by-contract in Python3 with informative violation messages and inheritance.
- pact-python - Python version of Pact. Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project.
-
Fake Data
- autofaker - designed to minimize the setup/arrange phase of your unit tests by removing the need to manually write code to create anonymous variables as part of a test cases setup/arrange phase.
- faker - A Python package that generates fake data.
- fake2db - Fake database generator.
- genuine-fake - Genuine Fake means an imitation of a (usually) valuable object that is so good that it is, to all intents and purposes, identical.
- mimesis - A Python library that helps you generate fake data.
- radar - Generate random datetime / time.
-
Fixtures
- protestr - A simple, powerful fixture provider for Python tests. Protestr's intuitive API lets you generate versatile fixtures for your test cases and inject them as dependencies on demand.
- pytest-deadfixtures - A simple plugin to list unused or duplicated fixtures in a pytest suite.
- pytest-mysql - A pytest plugin, that enables you to test your code that relies on a running MySQL Database. It allows you to specify fixtures for MySQL process and client.
- pytest-rabbitmq - A pytest plugin, that enables you to test your code that relies on a running RabbitMQ server. It allows you to specify fixtures for RabbitMQ server and client.
-
LLM & MCP Testing
- mcp-server-fuzzer - A comprehensive fuzzing tool designed specifically for testing Model Context Protocol (MCP) servers. It supports both tool argument fuzzing and protocol type fuzzing across multiple transport protocols.
- Tenro - An open-source, provider-agnostic testing framework for AI agents that integrates with pytest. It simulates LLM and tool calls to test edge cases, failure paths, and agent logic without live API calls.
-
Load Testing
- Dynamic Workload Model - Code to generate dynamic workload model. Useful for testing autoscaling in cloud or mimicking different load profile for different scenario.
- Grasshopper - A lightweight framework for performing load tests against an environment, primarily against an API. Grasshopper glues Locust, Pytest, some plugins (namely Locust InfluxDBListener ) and some custom code to provide a package that makes authoring load tests simple with very little boilerplate needed.
- Grizzly - is a framework to be able to easily define load scenarios, and is mainly built on-top of Locust and Behave.
- Locust - Scalable user load testing tool written in Python.
- pynonymizer - is a universal tool for translating sensitive production database dumps into anonymized copies.
- pynonymizer - is a universal tool for translating sensitive production database dumps into anonymized copies.
-
Memory Management
- tracemalloc - is a debug tool to trace memory blocks allocated by Python.
- filprofiler - A Python memory profiler for data processing and scientific computing applications.
- Guppy 3 - a Python programming environment & heap analysis toolset.
- mem_top - shows top suspects for memory leaks in your Python program.
- Pympler - is a development tool to measure, monitor and analyze the memory behavior of Python objects in a running Python application.
-
Mock and Stub
- mock - (Python standard library) A mocking and patching library.
- Aioresponses - is a helper for mock/fake web requests in python aiohttp package.
- Cornell - record & replay mock server.
- Flexmock - is a testing library for Python that makes it easy to create mocks, stubs and fakes.
- freezegun - Travel through time by mocking the datetime module.
- httmock - A mocking library for requests for Python 2.6+ and 3.2+.
- httpretty - HTTP request mock tool for Python.
- Kesha - A web service with a user interface for testing http requests and web hooks.
- Mockafka - Python library designed for mocking Kafka in a testing environment. It simplifies testing Kafka-integrated applications by providing an in-memory mock for aiokafka and confluent-kafka-python.
- mocket - A socket mock framework with gevent/asyncio/SSL support.
- Mockintosh - aims to provide usual HTTP mock service functionality with small resource footprint, making it friendly for microservice applications.
- Pretend - is a library to make stubbing with Python easier.
- responses - A utility library for mocking out the requests Python library.
- time-machine - Travel through time in your tests.
- trustme - gives you a fake certificate authority (CA) that you can use to generate fake TLS certs to use in your tests.
- doublex - Powerful test doubles framework for Python.
- D-MemFS - Zero-dependency in-memory virtual filesystem with hard quotas. Provides an explicit, isolated instance instead of patching global state.
- pyfakefs - A fake file system that mocks the Python file system modules.
- moto - allows you to easily mock out tests based on AWS infrastructure.
-
Mutation Testing
- Cosmic Ray - makes small changes to your source code, running your test suite for each one.
- Mutatest - Python mutation testing.
- Mutmut - is a mutation testing system for Python, with a strong focus on ease of use.
- MutPy - MutPy is a mutation testing tool for Python 3.x source code
- xmutant.py - Python 3.6 bytecode based mutation analysis framework
- bough - Bough is a polyglot incremental mutation tester.
-
Object Factories
- factory_boy - A test fixtures replacement for Python.
- mixer - Another fixtures replacement. Supports Django, Flask, SQLAlchemy, Peewee and etc.
- Model Bakery - offers you a smart way to create fixtures for testing in Django.
- polyfactory - A simple and powerful mock data generation library, based around type hints and supporting dataclasses, typed-dicts, pydantic models, msgspec structs and more.
-
Penetration Testing
- fsociety - A Modular Penetration Testing Framework.
- python-pentest-tools - Python tools for penetration testers.
- fencer - Fencer is an automated API security testing tool. It's an experimental project to see how much of the API security testing process can be automated.
-
Property Based Testing
- Atheris - is a coverage-guided Python fuzzing engine. It supports fuzzing of Python code, but also native extensions written for CPython.
- hypofuzz - Adaptive fuzzing of Hypothesis tests.
- Hypothesis - is an advanced Quickcheck style property based testing library.
- hypothesis-crosshair - Add the power of solver-based symbolic execution to your Hypothesis tests with CrossHair.
- icontract-hypothesis - Instead of writing manually the Hypothesis search strategies for a function, `icontract-hypothesis` infers them based on the function's precondition.
- hypothesis-auto - An extensions for Hypothesis that provides fully automatic testing for type hinted functions.
-
Reporting
- pytest-html-plus - Get a self-contained, actionable, easy-to-read single page HTML unified reports summarizing all your test results. Detect flaky tests.
-
Resources
-
Articles
- Anna-Lena Popkes: "Mocking in Python" - Mocking might seem confusing in the beginning but once you understand the basics it can be very helpful.
- async test patterns for Pytest - Learn some handy async examples and patterns for testing in Pytest.
- Getting Started With Property-Based Testing in Python With Hypothesis and Pytest
- How not to footgun yourself when writing tests - a showcase of flaky tests
- Stargirl Flowers: “My Python testing style guide” - An attempt to catalog some practices around testing Python projects. It's not meant to be treated as dogma.
- Test & Code: Python Testing - Test & Code is a weekly podcast hosted by Brian Okken. The show covers a wide array of topics including software engineering, development, testing, Python programming, and many related topics.
- Testing your Python Code with Hypothesis - A look at how Hypothesis can help you discover errors in your code.
- Patterns of flakey Python tests - This post details several patterns that cause flakey Python tests. Being aware of these common causes can help when investigating your own flakey tests.
- Unit testing Python code in Jupyter notebooks - This article covers several options for unit testing Python code in a Jupyter notebook.
- 30 best practices for software development and testing - These software engineering rules and testing best practices might help save you time and headaches.
- Stargirl Flowers: “My Python testing style guide” - An attempt to catalog some practices around testing Python projects. It's not meant to be treated as dogma.
- Unit testing Python code in Jupyter notebooks - This article covers several options for unit testing Python code in a Jupyter notebook.
-
Books
- Architecture Patterns with Python
- Crafting Test-Driven Software with Python
- Python Testing with pytest
- Python Testing with Selenium
- Python Unit Test Automation
- Testing In Python
- Testing Python
- Test-Driven Development with Python
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Crafting Test-Driven Software with Python
- pytest Quick Start Guide
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
-
Programming Languages
Categories
Resources
173
Testing Frameworks
21
Mock and Stub
19
UI Testing
16
Tools
15
Static Checks
13
Rest API Testing
11
Assertions
9
Property Based Testing
6
Load Testing
6
Mutation Testing
6
Fake Data
6
Speed
6
Snapshot Tests
5
Memory Management
5
Behavior-driven Development
4
Fixtures
4
Object Factories
4
Retrying Tests
3
Code Coverage
3
Test Runners
3
Penetration Testing
3
Design by Contract
3
LLM & MCP Testing
2
Reporting
1
Sub Categories
Keywords
python
70
testing
48
pytest
14
testing-tools
12
python3
10
http
10
testing-framework
9
pytest-plugin
9
test-automation
8
mock
8
unit-testing
7
linter
7
webdriver
6
mocking
6
static-analysis
5
selenium
5
fixtures
5
performance-testing
5
bdd
5
automation
5
cli
5
rust
4
static-code-analysis
4
mutation-testing
4
api
4
test-runner
4
selenium-python
3
fuzzing
3
tdd
3
testing-library
3
e2e-testing
3
unit-test
3
unittest
3
behavior-driven-development
3
gherkin
3
code-quality
3
openapi
3
test
3
requests
3
django
3
performance
3
locust
3
load-testing
3
benchmarking
3
mypy
3
awesome
3
security
3
validation
2
typing
2
flake8
2