79 / 80 · 12 Programming for QA · Bash Scripting for QA← prev⊞ allnext →☰ Read as one page
9.9Practical Exercise
Write a bash script that:
- Accepts an environment name as a command-line argument (staging/production)
- Starts a local database using Docker
- Waits for the database to be ready (health check loop)
- Runs smoke tests with pytest
- Captures the test exit code
- Cleans up Docker containers (using trap)
- Exits with the test exit code