Test Strategy, CI and Quality Culture
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:
- Lint and static checks:
pyflakes,ruff,node --check, ShellCheck. - Unit and integration tests.
- E2E tests against a running app.
- 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)
- Red: write a failing test for the behaviour you want.
- Green: write the simplest code that passes.
- 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 autowith 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.
Ihr Fortschritt wird nur in diesem Browser gespeichert.
Zur Prüfung einreichen (10 Punkte)