Skip to content

Last updated: 2026-07-21

Status:

Tags: Software Engineering, Programming

Testing ​

API testing frameworks

  • Test suite: Collection of all tests
  • Unit test: Tests an isolated feature
  • Integration test: Ensures components work together
  • Regression test: Prevents reoccurrence of past bugs
  • Mocking: Replacing parts of a system to isolate tests

Step 1 — Basics of Testing in Python ​


Step 2 — Modern Testing With pytest ​

  • Why pytest: Less boilerplate, powerful fixtures, better readability.

  • Learn:

    • Writing simple test functions.

    • Using fixtures for setup/teardown.

    • Parametrized tests.

  • 📖 Tutorial:

  • 🏋️ Practice:

    • Convert your unittest tests to pytest.

    • Add multiple test cases using @pytest.mark.parametrize.


Step 3 — Mocking and Patching ​


Step 4 — Integration and Regression Testing ​

  • Learn:

    • Running tests against a staging DB or local API server.

    • Adding regression tests when fixing bugs.

  • 📖 Tutorial:

  • 🏋️ Practice:

    • Write a test that inserts & fetches data from a SQLite DB.

    • After fixing a bug, write a test reproducing it.


Step 5 — Test Automation & Coverage ​

  • Learn:

    • Running tests in CI/CD (GitHub Actions, GitLab CI).

    • Measuring coverage (coverage.py).

  • 📖 Tutorial:

  • 🏋️ Practice:

    • Set up GitHub Actions to run tests on every push.

    • Achieve at least 90% code coverage for a small project.


Step 6 — Advanced Testing Practices ​

  • Learn:

    • Property-based testing (hypothesis).

    • Performance testing.

    • Snapshot testing.

  • 📖 Tutorial:

  • 🏋️ Practice:

    • Use Hypothesis to test your function with random inputs.

    • Create performance benchmarks for critical functions.


3. ​

Reference ​

Built as an open learning notebook