Collection of awesome Python resources for testing and generating test data.
- Testing Frameworks
- Test Runners
- Property Based Testing
- Mutation Testing
- Behavior-driven Development
- UI Testing
- Rest API Testing
- Load Testing
- Penetration Testing
- Mock
- Assertions
- Object Factories
- Fake Data
- Design by Contract
- Code Coverage
- Static Checks
- Articles
- Tools
- Related
- pytest - A mature full-featured Python testing tool.
- awesome-pytest - A curated list of awesome pytest resources.
- hammett - Fast python test runner, compatible with a subset of pytest.
- 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.
- nose2 - The successor to
nose
, based onunittest2
. - Robot Framework - A generic test automation framework.
- awesome-robotframework - A curated list of awesome Robot Framework resources and libraries.
- testbook - A unit testing framework extension for testing code in Jupyter Notebooks.
- ward - Ward is a modern test framework for Python with a focus on productivity and readability.
- async-asgi-testclient - A framework-agnostic library for testing ASGI web applications.
- green - A clean, colorful test runner.
- tox - Auto builds and tests distributions in multiple Python versions.
- nox - Nox is a command-line tool that automates testing in multiple Python environments, similar to tox. Unlike tox, Nox uses a standard Python file for configuration.
- hypothesis - Hypothesis is an advanced Quickcheck style property based testing library.
- Atheris - Atheris is a coverage-guided Python fuzzing engine. It supports fuzzing of Python code, but also native extensions written for CPython.
- mutmut - Mutmut is a mutation testing system for Python, with a strong focus on ease of use.
- Cosmic Ray - Cosmic Ray is a mutation testing tool for Python 3. It makes small changes to your source code, running your test suite for each one.
- mamba - The definitive testing tool for Python. Born under the banner of BDD.
- behave - BDD, Python style.
- lettuce - Behavior-driven-development tool for python, inspired by Cucumber for Ruby.
- PyAutoGUI - PyAutoGUI is a cross-platform GUI automation Python module for human beings.
- Selenium - Python bindings for Selenium WebDriver.
- SeleniumBase - 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.
- sixpack - A language-agnostic A/B Testing framework.
- splinter - Open source tool for testing web applications.
- helium - Selenium-python is great for web automation. Helium makes it easier to use.
- LuluTest - LuluTest is an open source browser automation framework using Python and Selenium. It is relatively lightweight in that it mostly provides wrappers for 3rd party library methods that make browser automation and testing more intuitive.
- Golem - 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.
- selene - User-oriented Web UI browser tests in Python (Selenide port).
- Schemathesis - A tool for automatic property-based testing of web applications built with Open API / Swagger specifications.
- hypothesis-graphql - Hypothesis strategies for GraphQL schemas, queries and data.
- tavern - 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.
- SnapshotTest - Snapshot testing is a way to test your APIs without writing actual test cases.
- playback - A Python decorator-based framework that lets you "record" and "replay" operations (e.g. API requests, workers consuming jobs from queues).
- behave-restful - BDD Framework to Test REST Services and APIs.
- RESTler - 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.
- HttpRunner - HttpRunner is a simple & elegant, yet powerful HTTP(S) testing framework.
- locust - Scalable user load testing tool written in Python.
- dynamic-workload-model - Code to generate dynamic workload model. Useful for testing autoscaling in cloud or mimicking different load profile for different scenario.
- pynonymizer - Pynonymizer is a universal tool for translating sensitive production database dumps into anonymized copies. This can help you support GDPR/Data Protection in your organization without compromizing on quality testing data.
- fsociety - A Modular Penetration Testing Framework.
- doublex - Powerful test doubles framework for Python.
- freezegun - Travel through time by mocking the datetime module.
- time-machine - Travel through time in your tests.
- httmock - A mocking library for requests for Python 2.6+ and 3.2+.
- httpretty - HTTP request mock tool for Python.
- mock - (Python standard library) A mocking and patching library.
- mocket - A socket mock framework with gevent/asyncio/SSL support.
- responses - A utility library for mocking out the requests Python library.
- VCR.py - Record and replay HTTP interactions on your tests.
- moto - A library that allows you to easily mock out tests based on AWS infrastructure.
- Mockintosh - Mockintosh aims to provide usual HTTP mock service functionality with small resource footprint, making it friendly for microservice applications. You can have tens of mocks at once, inside moderate laptop or single Docker container.
- flexmock - Flexmock is a testing library for Python that makes it easy to create mocks, stubs and fakes.
- cornell - Cornell: record & replay mock server.
- aioresponses - Aioresponses is a helper for mock/fake web requests in python aiohttp package.
- Precisely - Precisely allows you to write precise assertions so you only test the behaviour you're really interested in. This makes it clearer to the reader what the expected behaviour is, and makes tests less brittle.
- sure - An idiomatic assertion toolkit with human-friendly failure messages, inspired by RSpec Expectations and should.js.
- factory_boy - A test fixtures replacement for Python.
- mixer - Another fixtures replacement. Supports Django, Flask, SQLAlchemy, Peewee and etc.
- model_bakery - Model Bakery offers you a smart way to create fixtures for testing in Django. With a simple and powerful API you can create many objects with a single line of code.
- fake2db - Fake database generator.
- faker - A Python package that generates fake data.
- mimesis - A Python library that helps you generate fake data.
- radar - Generate random datetime / time.
- 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.
- icontract - Design-by-contract in Python3 with informative violation messages and inheritance.
- deal - Design by contract for Python with static checker and test generation.
- coverage - Code coverage measurement.
- coverage-conditional-plugin - Conditional coverage based on any rules you define.
- diff_cover - Automatically find diff lines that need test coverage.
- pyflakes - A simple program which checks Python source files for errors.
- pylint - Pylint is 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.
- pyanalyze - A tool for programmatically detecting common mistakes in Python code, such as references to undefined variables and some categories of type mismatches.
- bandit - Bandit is a tool designed to find common security issues in Python code.
- flake8 - flake8 is a python tool that glues together pep8, pyflakes, mccabe, and third-party plugins to check the style and quality of python code.
- awesome-flake8-extensions - A curated list of awesome flake8 extensions.
- Typecheckers - A list of Python type checkers.
- awesome-python-typing - Collection of awesome Python types, stubs, plugins, and tools to work with them.
- 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.
- 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.
- Unit testing Python code in Jupyter notebooks - This article covers several options for unit testing Python code in a Jupyter notebook.
- async test patterns for Pytest - Learn some handy async examples and patterns for testing in Pytest.
- Pynguin - Pynguin, the PYthoN General UnIt test geNerator, is a tool that allows developers to generate unit tests automatically.
- Ponicode - AI-powered unit testing interface for VS Code. Write, generate, modify and visualise all kinds of unit tests for JavaScript, TypeScript and Python.
- Auger - Auger is a project to automatically generate unit tests for Python code.
- ApprovalTests - Approvals work by comparing the test results to a golden master.
- pytest-codegen - Pytest-codgen will statically analyze your code to create pytest function stubs.
- teyit - A static analyzer and a refactoring tool to rewrite your unittest assertions in the right way.
- pifpaf - Pifpaf is 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.
- mock_autogen - A tool to auto generate the basic mocks and asserts for faster unit testing using the AAA pattern.
- ghostwriter - Writing tests with Hypothesis frees you from the tedium of deciding on and writing out specific inputs to test. Now, the hypothesis.extra.ghostwriter module can write your test functions for you too!
- Klara - Klara is a static analysis tools to automatic generate test case, based on SMT (z3) solver, with a powerful ast level inference system. Klara will take python file as input and generate corresponding test file in pytest format, that attempt to cover all return values.
- CrossHair - An analysis tool for Python that blurs the line between testing and type systems.
- 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.