Middle+
Tell me about types of testing and tools/frameworks.
sobes.tech AI
Answer from AI
Types of testing:
- Unit Testing — testing individual functions or classes.
- Integration Testing — testing the interaction between modules.
- Functional Testing — testing functionality according to requirements.
- System Testing — testing the entire system as a whole.
- Acceptance Testing — verifying the system's readiness for users.
- Regression Testing — ensuring that changes haven't broken existing functionality.
- Load Testing — testing behavior under load.
Tools and frameworks in Python:
- unittest — built-in module for unit testing.
- pytest — popular framework with a convenient syntax and extensions.
- nose2 — extension of unittest with additional features.
- tox — automation of running tests in different environments.
- mock — for creating stubs and mocks.
- Selenium — for automating browser testing.
- Locust — for load testing.
Example of a simple test with pytest:
import pytest
def add(a, b):
return a + b
def test_add():
assert add(2, 3) == 5
Run with: pytest.