Photo by Mathew Schwartz / Unsplash

cURL Exercises for Testers

Exercises Jul 24, 2025

placeholder

Information about an endpoint

Try curl -I "https://www.workroom-productions.com/curl-exercises-for-testers/"

compare with curl -I "https://agiletestingdays.com/2025/session/the-art-of-crafting-your-custom-tools/"

Using with other tools

curl uses different output streams:

  • stdout: HTTP response headers/body
  • stderr: Progress information, error messages

When curl detects:

  • Terminal output: Shows headers only, no progress meter
  • Piped output: Shows progress meter to stderr, sends headers to stdout

See what happens when piping to other tools: curl -I "https://www.workroom-productions.com/curl-exercises-for-testers/" | grep "status"

Note the unexpected extra info compared with curl -I "https://www.workroom-productions.com/curl-exercises-for-testers/"

Manage this with -s

Compare with curl -sI "https://www.workroom-productions.com/curl-exercises-for-testers/" | grep "Status"

Information about a connection

try curl -vI "https://www.workroom-productions.com/curl-exercises-for-testers/"

Speed

try curl -w "Total time: %{time_total}s\n" -s -o /dev/null "https://www.workroom-productions.com/curl-exercises-for-testers/"

This uses the -w writeeout option, which exposes information about the transaction:

VariableDescription
%{content_type}Content-Type of response
%{http_code}HTTP status code
%{http_connect}HTTP connect response code
%{local_ip}Local IP address
%{local_port}Local port number
%{num_connects}Number of connections made
%{num_redirects}Number of redirects
%{remote_ip}Remote IP address
%{remote_port}Remote port number
%{size_download}Bytes downloaded
%{size_header}Bytes of headers downloaded
%{size_request}Bytes sent in request
%{size_upload}Bytes uploaded
%{speed_download}Download speed (bytes/sec)
%{speed_upload}Upload speed (bytes/sec)
%{time_appconnect}SSL/TLS handshake time
%{time_connect}Connection establishment time
%{time_namelookup}DNS lookup time
%{time_pretransfer}Pre-transfer time
%{time_redirect}Redirect time
%{time_starttransfer}Time to first byte
%{time_total}Total time
%{url_effective}Final URL after redirects

Tags

James Lyndsay

Getting better at software testing. Singing in Bulgarian. Staying in. Going out. Listening. Talking. Writing. Making.