1.12. Test About

1.12.1. Testing Frameworks

  • Unit Testing: unittest, pytest

  • Integration: doctests

  • Behavioral: behave, lettuce

  • Performance: locust, gatling (scala), jMeter (java)

  • Security: bandit

  • Codestyle: ruff, black

  • Static: pylint, sonar-scanner, flake8, pylama, pyflakes

  • Types: mypy, pyre-check, pytypes

  • Convention: pydocstyle, pycodestyle, isort,

  • Deadcode: eradicate, vulture

  • Mutation: mutmut, cosmic-ray, mutatest, mutpy

  • Coverage: coverage, mccabe, radon

1.12.2. Mock vs Stub

  • Stub - simple object which always returns the same result

  • Mock - an object which has more advanced capabilities than Stub, such as:

    counting number of calls, recording passed arguments etc.

Note, that usage of Stubs and Mocks is only for testing purposes. You should not do that in your programs at the production level! Mocks and Stubs assumes, that user will input particular values.