Manuals / Linux & CLI for Testers / Chapter 7
B · Tester toolkit · intermediate · ~40 min · Chapter 7 of 9
Small scripts that help testing Loops, variables, exit codes. Automate boring setup: seed data, wait for port, collect logs.
Wait-for-url script
Wait-for-url script Drag stickies · tap for tips
Study map Drag stickies · tap for tips Keep it short drag · tap → Name the wait drag · tap → Scope locators drag · tap → Trace when stuck drag · tap → One browser first drag · tap → Isolate state drag · tap → Assert the UI drag · tap → Retry wisely drag · tap → Seed data drag · tap → Close the loop drag · tap → Keep it short drag · tap → Name the wait drag · tap → Scope locators drag · tap → Trace when stuck drag · tap → One browser first drag · tap → Isolate state drag · tap → Pathwise hack drag · tap → Wait-for-url scrip drag · tap → Try this drag · tap → Follow the dashed drag · tap → Example
#!/usr/bin/env bash
set -euo pipefail
url=${1:-https://httpbin.org/status/200}
for i in {1..10}; do
if curl -sf "$url" >/dev/null; then echo ready; exit 0; fi
sleep 1
done
echo timeout >&2; exit 1Do this now
Write a script that curls until 200 or times out.
Your note Was this step clear? Yes Needs work
← Prev Finish chapter → Chapter learning outcomes bash basics exit codes set -euo pipefail lite Clear these before you leave ← Networking lite for QA Manual home SSH & remote logs →