Software Testing & QA

Test Strategy, CI and Quality Culture

30 मिनट

Run everything on every push

A test suite only protects you if it runs. Put it in CI (see Automation & Scripting) and block merges when it fails. Typical stages, fastest first:

  1. Lint and static checks: pyflakes, ruff, node --check, ShellCheck.
  2. Unit and integration tests.
  3. E2E tests against a running app.
  4. Security checks: pip-audit, npm audit, secret scanning.

Fast feedback matters: aim for the main suite to finish in under ten minutes.

Coverage in CI

pip install pytest-cov
pytest --cov=app --cov-report=term-missing

term-missing lists the exact lines never executed. Look there for untested error handling and permission checks.

Test-driven development (TDD)

  1. Red: write a failing test for the behaviour you want.
  2. Green: write the simplest code that passes.
  3. Refactor: clean up with the test as your safety net.

TDD is especially effective for bug fixes: first write a test that reproduces the bug, watch it fail, then fix it. The bug can never silently return.

Keeping the suite healthy

  • Quarantine flaky tests immediately and fix them; a suite people ignore is worse than none.
  • Delete tests for removed features.
  • Keep test code as clean as production code: helpers, clear names, no copy-paste walls.
  • Measure suite time and split or parallelise (pytest -n auto with pytest-xdist) when it grows.

Beyond automated tests

  • Code review catches design and security issues tests cannot.
  • Exploratory testing: spend 20 minutes trying to break a new feature as a curious user would.
  • Monitoring and error tracking (Sentry) are tests that run in production.
  • Accessibility checks: keyboard-only navigation, contrast, screen-reader labels; tools like axe automate part of it.

Final project

For one of your apps: add a CI pipeline with lint, unit, integration (on PostgreSQL) and two E2E journeys; add a parametrized permission test for every protected route; reach meaningful coverage on payments and authentication; then fix one real bug with TDD. You will have a suite that lets you ship changes with confidence, which is the whole point.

आपकी प्रगति केवल इसी ब्राउज़र में सहेजी जाती है।

समीक्षा के लिए भेजें (10 अंक)