awesome-python-testing
Collection of awesome 😎️ Python resources for testing
https://github.com/cleder/awesome-python-testing
Last synced: 9 days ago
JSON representation
-
Static Checks
- awesome-python-typing - Collection of awesome Python types, stubs, plugins, and tools to work with them.
- flake8 - is a python tool that glues together pep8, pyflakes, mccabe, and third-party plugins to check the style and quality of python code.
- Bandit - is a tool designed to find common security issues in Python code.
- typos - A Source code spell checker that finds and corrects spelling mistakes in source code.
- Refurb - A tool for refurbishing and modernizing Python codebases.
- pyflakes - A simple program which checks Python source files for errors.
- awesome-flake8-extensions - A curated list of awesome flake8 extensions.
- pyanalyze - A tool for programmatically detecting common mistakes in Python code, such as references to undefined variables and some categories of type mismatches.
- slotscheck - Find mistakes in your `__slots__` definitions.
- complexipy - An extremely fast Python library to calculate the cognitive complexity of Python files, written in Rust.
- ruff - An extremely fast Python linter, written in Rust.
- Pylint - A Python static code analysis tool which looks for programming errors, helps enforcing a coding standard, sniffs for code smells and offers simple refactoring suggestions.
- Typecheckers - A list of Python type checkers.
-
Testing Frameworks
- unittest - (Python standard library) Unit testing framework.
- doctest - (Python standard library) The doctest module searches for pieces of text that look like interactive Python sessions, and then executes those sessions to verify that they work exactly as shown.
- Robot Framework - A generic test automation framework.
- nose2 - The successor to `nose`, based on `unittest2`.
- Ward - is a modern test framework for Python with a focus on productivity and readability.
- xdoctest - A rewrite of Python's builtin doctest module (with pytest plugin integration) with AST instead of REGEX.
- testbook - A unit testing framework extension for testing code in Jupyter Notebooks.
- async-asgi-testclient - A framework-agnostic library for testing ASGI web applications.
- awesome-pytest - A curated list of awesome pytest resources.
- hammett - Fast python test runner, compatible with a subset of pytest.
- maelstrom - Maelstrom is a fast Rust and Python test runner that runs every test in its own container. Tests are either run locally or distributed to a clustered job runner.
- perftester - A lightweight framework for performance testing of Python functions; allows for testing of performance in terms of execution time and memory usage.
- promptimize - a prompt engineering evaluation and testing toolkit. It accelerates and provides structure around prompt engineering at scale with confidence, bringing some of the ideas behind test-driven development (TDD) to engineering prompts.
- sundew - Sundew is a testing framework for Python, implementing a new approach to testing. One that combines functional programming concepts and the general best practices for writing tests that we already know, and enforces them in a way that enables some really powerful features that make testing easier, enjoyable, and more effective.
- vedro - Pragmatic testing framework for Python
- Sphinx-testify - Testified documentation means that the documentation source references test results, and these references are verified during the build process. As a result, we can keep every paragraph even every sentence of the documentation aligned with the code, as long as there is a test that "testifies" the described behaviour.
-
Mock and Stub
- mock - (Python standard library) A mocking and patching library.
- responses - A utility library for mocking out the requests Python library.
- Aioresponses - is a helper for mock/fake web requests in python aiohttp package.
- freezegun - Travel through time by mocking the datetime module.
- trustme - gives you a fake certificate authority (CA) that you can use to generate fake TLS certs to use in your tests.
- mocket - A socket mock framework with gevent/asyncio/SSL support.
- httpretty - HTTP request mock tool for Python.
- httmock - A mocking library for requests for Python 2.6+ and 3.2+.
- time-machine - Travel through time in your tests.
- Flexmock - is a testing library for Python that makes it easy to create mocks, stubs and fakes.
- Mockintosh - aims to provide usual HTTP mock service functionality with small resource footprint, making it friendly for microservice applications.
- Cornell - record & replay mock server.
- 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.
- Pretend - is a library to make stubbing with Python easier.
- doublex - Powerful test doubles framework for Python.
-
Resources
-
Articles
- 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.
- 30 best practices for software development and testing - These software engineering rules and testing best practices might help save you time and headaches.
- 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.
- 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.
-
Related
- Awesome Python - A curated list of awesome Python frameworks, libraries, software and resources.
- Python test automation - A comprehensive curated list of python test automation frameworks, tools, libraries and software to help software engineers easily bootstrap test automation on python.
- commit-check - Check commit message formatting, branch naming, commit author, email, and more.
-
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
- Python Testing with Selenium
- 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
- Architecture Patterns with Python
- Python Testing with Selenium
- Python Unit Test Automation
- Python Testing with Selenium
- Python Testing with Selenium
- Python Testing with Selenium
-
Videos
- PyCascades 2023 - Talk - Brian Okken: "Sharing is Caring - Sharing pytest Fixtures"
- PyCon US 2023 - Talk - Dan Craig: Testing Spacecraft with Pytest
- PyCon US 2023 - Talk - Dave Aronson: Kill All Mutants! (Intro to Mutation Testing)
- PyCon US 2023 - Talk - Shai Geva: 10 Ways To Shoot Yourself In The Foot With Tests
- PyCon US 2023 - Tutorial - Zac Hatfield-Dodds, Ryan Soklaski: Introduction to Property-Based Testing
- PyCascades 2023 - Talk - Brian Okken: "Sharing is Caring - Sharing pytest Fixtures"
- PyCon US 2023 - Talk - Dan Craig: Testing Spacecraft with Pytest
- PyCon US 2023 - Talk - Dave Aronson: Kill All Mutants! (Intro to Mutation Testing)
- PyCon US 2023 - Talk - Shai Geva: 10 Ways To Shoot Yourself In The Foot With Tests
- PyCon US 2023 - Tutorial - Zac Hatfield-Dodds, Ryan Soklaski: Introduction to Property-Based Testing
-
-
Memory Management
- tracemalloc - is a debug tool to trace memory blocks allocated by Python.
- Pympler - is a development tool to measure, monitor and analyze the memory behavior of Python objects in a running Python application.
- Guppy 3 - a Python programming environment & heap analysis toolset.
- filprofiler - A Python memory profiler for data processing and scientific computing applications.
- mem_top - shows top suspects for memory leaks in your Python program.
-
Tools
- ghostwriter - Writing tests with Hypothesis frees you from the tedium of deciding on and writing out specific inputs to test.
- Pifpaf - A suite of fixtures and a command-line tool that allows to start and stop daemons for a quick throw-away usage. This is typically useful when needing these daemons to run integration testing.
- CrossHair - An analysis tool for Python that blurs the line between testing and type systems.
- Pynguin - A tool that allows developers to generate unit tests automatically.
- Klara - Static analysis tools to automatic generate test case, based on SMT (z3) solver, with a powerful ast level inference system.
- Auger - Project to automatically generate unit tests for Python code.
- teyit - A static analyzer and a refactoring tool to rewrite your unittest assertions in the right way.
- importlab - A library that automatically infers dependencies for Python files. Importlab's main use case is to work with static analysis tools that process one file at a time, ensuring that a file's dependencies are analysed before it is.
- logot - Test whether your code is logging correctly.
- pytest-codegen - Pytest-codegen will statically analyze your code to create pytest function stubs.
- pytestify - Automatically convert unittests to pytest.
- pytest-mock-generator - A pytest fixture wrapper for `mock_autogen`.
- pytest-databases - Reusable database fixtures for any and all databases.
-
Rest API Testing
- Zato API Test - API testing in pure English. No programming needed. Implemented and extendable in Python.
- RESTler - is the first stateful REST API fuzzing tool for automatically testing cloud services through their REST APIs and finding security and reliability bugs in these services.
- Tavern - is a pytest plugin, command-line tool and Python library for automated testing of APIs, with a simple, concise and flexible YAML-based syntax.
- Dredd - is a language-agnostic command-line tool for validating API description document against backend implementation of the API.
- HttpRunner - is a simple & elegant, yet powerful HTTP(S) testing framework.
- cherrybomb - CLI tool that helps you avoid undefined user behaviour by auditing your API specifications, validating them and running API security tests.
- behave-restful - BDD Framework to Test REST Services and APIs.
- hypothesis-graphql - Hypothesis strategies for GraphQL schemas, queries and data.
- playback - A Python decorator-based framework that lets you "record" and "replay" operations (e.g. API requests, workers consuming jobs from queues).
- Schemathesis - A tool for automatic property-based testing of web applications built with Open API / Swagger specifications.
-
Fake Data
- fake2db - Fake database generator.
- faker - A Python package that generates fake data.
- mimesis - A Python library that helps you generate 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.
- 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.
- radar - Generate random datetime / time.
-
Load Testing
- Locust - Scalable user load testing tool written in Python.
- 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.
- Dynamic Workload Model - Code to generate dynamic workload model. Useful for testing autoscaling in cloud or mimicking different load profile for different scenario.
- Grizzly - is a framework to be able to easily define load scenarios, and is mainly built on-top of Locust and Behave.
- pynonymizer - is a universal tool for translating sensitive production database dumps into anonymized copies.
-
Object Factories
- factory_boy - A test fixtures replacement for Python.
- Model Bakery - offers you a smart way to create fixtures for testing in Django.
- mixer - Another fixtures replacement. Supports Django, Flask, SQLAlchemy, Peewee and etc.
- polyfactory - A simple and powerful mock data generation library, based around type hints and supporting dataclasses, typed-dicts, pydantic models, msgspec structs and more.
-
UI Testing
- PyAutoGUI - is a cross-platform GUI automation Python module for human beings.
- Flybirds - is a front-end UI automation test framework based on BDD mode, providing a series of out-of-the-box tools and complete documentation.
- SeleniumBase - is an all-in-one Python framework for automated browser testing. Tests are run with "pytest", and use WebDriver APIs for web-page interaction.
- splinter - Open source tool for testing web applications.
- selene - User-oriented Web UI browser tests in Python (Selenide port).
- Golem - is a test framework and a complete tool for browser automation. Tests can be written with code in Python, codeless using the web IDE, or both.
- Lost Pixel - is an open source visual regression testing tool. Run visual regression tests on your Storybook and Ladle stories and on your application pages.
- LuluTest - is an open source browser automation framework using Python and Selenium.
- pytest-ui-automatic - Playwright Python tool practice pytest pytest-bdd screen-play page-object allure cucumber-report.
- squape - is a package that extends Squish API providing convenience tools for everyday automated test cases development.
- pomcorn - is an open source Python package that contains base classes to create systems based on Selenium framework and Page Object Model pattern
- Selenium - Python bindings for [Selenium](http://www.seleniumhq.org/) WebDriver.
- helium - is great for web automation. Helium makes it easier to use.
- sixpack - A language-agnostic A/B Testing framework.
- aria-testing - Accessibility-focused DOM testing library for tdom, built with modern Python 3.14+.
-
Design by Contract
- 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.
- icontract - Design-by-contract in Python3 with informative violation messages and inheritance.
- deal - Design by contract for Python with static checker and test generation.
-
Snapshot Tests
- VCR.py - Record and replay HTTP interactions on your tests.
- ApprovalTests - work by comparing the test results to a golden master.
- SnapshotTest - is a way to test your APIs without writing actual test cases.
- syrupy - is a zero-dependency pytest snapshot plugin. It enables developers to write tests which assert immutability of computed results.
-
Property Based Testing
- Hypothesis - is an advanced Quickcheck style property based testing library.
- 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-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.
-
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
- Cosmic Ray - makes small changes to your source code, running your test suite for each one.
- Mutatest - Python mutation testing.
- xmutant.py - Python 3.6 bytecode based mutation analysis framework
-
Fixtures
- pytest-deadfixtures - A simple plugin to list unused or duplicated fixtures in a pytest suite.
- 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.
-
Speed
- pytest-testmon - Selects tests affected by changed files. Continuous test runner when used with pytest-watch.
- Pytest-incremental - analyses your project structure and file modifications between test-runs to modify the order tests are executed and de-select tests.
- Awesome pytest speedup - A checklist of best practices to speed up your pytest suite.
- Partial Testing - Run only the tests that are relevant for your changes.
- Django-Mercury-Performance-Testing - Quickly & Ergonomically transform your Django Tests to track performance statistics like response time, queries, memory usage, and more!
-
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.
-
Penetration Testing
- python-pentest-tools - Python tools for penetration testers.
- fsociety - A Modular Penetration Testing Framework.
- 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.
-
Code Coverage
- diff_cover - Automatically find diff lines that need test coverage.
- coverage-conditional-plugin - Conditional coverage based on any rules you define.
- Coverage.py - is a tool for measuring code coverage of Python programs.
-
Assertions
- sure - An idiomatic assertion toolkit with human-friendly failure messages, inspired by RSpec Expectations and should.js.
- 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.
- 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.
- 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.
-
Test Runners
- green - A clean, colorful test runner.
-
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.
Programming Languages
Categories
Resources
165
Testing Frameworks
16
Mock and Stub
16
UI Testing
15
Tools
13
Static Checks
13
Rest API Testing
10
Assertions
9
Fake Data
6
Speed
5
Memory Management
5
Mutation Testing
5
Load Testing
5
Property Based Testing
5
Object Factories
4
Snapshot Tests
4
Code Coverage
3
Design by Contract
3
Behavior-driven Development
3
Penetration Testing
3
Fixtures
2
LLM & MCP Testing
1
Test Runners
1
Sub Categories
Keywords
python
67
testing
46
pytest
11
testing-tools
11
http
10
python3
10
testing-framework
8
mock
8
test-automation
8
linter
7
pytest-plugin
7
unit-testing
6
webdriver
6
automation
5
performance-testing
5
selenium
5
bdd
5
fixtures
5
static-analysis
5
mocking
5
mutation-testing
4
rust
4
api
4
cli
4
static-code-analysis
4
code-quality
3
e2e-testing
3
selenium-python
3
fuzzing
3
testing-library
3
tdd
3
unit-test
3
behavior-driven-development
3
gherkin
3
openapi
3
test-runner
3
test
3
requests
3
django
3
performance
3
locust
3
load-testing
3
mypy
3
benchmarking
3
awesome
3
security
3
hypothesis
2
rest-api
2
httpretty
2
behave
2