Modern QA2026Practical Exercise — tiles
Log inJoin
79 / 80 · 12 Programming for QA · Bash Scripting for QA← prev⊞ allnext →☰ Read as one page

9.9Practical Exercise

Write a bash script that:

  1. Accepts an environment name as a command-line argument (staging/production)
  2. Starts a local database using Docker
  3. Waits for the database to be ready (health check loop)
  4. Runs smoke tests with pytest
  5. Captures the test exit code
  6. Cleans up Docker containers (using trap)
  7. Exits with the test exit code