Programming · free software · the open webSubscribe via RSS

Building a Small Schedule Lookup Smoke Check

From the earlier reference collection. Read the current software blog.

A lightweight smoke check should exercise a permitted public lookup, verify a usable response, and return a clear failure status without assuming an undocumented API.

Check the public behavior

A smoke check asks whether a basic user-visible path still works. Start with a lookup that is allowed by the site’s normal interface and does not depend on private credentials or guessed endpoints. If the resource provides no supported machine interface, do not scrape aggressively; a manual check or a documented endpoint is more appropriate.

Define what “usable” means before writing code. A response might need to load successfully, contain a recognizable result area, and avoid a visible error message. A successful network connection alone is not enough if the page communicates that the search failed.

Keep the check narrow

Use one stable, low-impact query chosen for the purpose of checking the interface. Set a timeout and make the request interval modest. Do not repeatedly submit searches or create load merely to increase confidence. If test data or a sandbox exists, prefer that over a live planning scenario.

Separate transport, response, and content checks. A timeout is a connectivity failure; a server error is an HTTP failure; a page that loads but lacks expected content is a usability or markup failure. Report these separately so the person on call knows where to start.

Return a meaningful status

A small command can use exit code zero when the check completes and finds a usable response, and distinct nonzero codes for timeout, server failure, or unexpected content. Print a concise message to standard error on failure and include elapsed time. Do not echo cookies, authorization details, or a full response body into scheduled logs.

For example, a scheduler can alert when the command exits nonzero, while a human can run it interactively to see whether the failure is repeatable. Keep the check independent of the production search cache where possible; otherwise a cached success could conceal a broken public path, or a cache miss could create a false failure.

Make scope explicit

Document the URL or interface used, the query assumptions, expected response markers, and how often the check runs. The check only establishes that one chosen path worked at one time. It does not prove that every route, date, transfer, or user’s browser will behave the same way.

A train and bus schedule lookup makes the use case concrete: a reader needs a response that helps with a departure question. Treat the page as a public resource to inspect, not as proof of an undocumented API. The check should follow the site’s published access guidance and report only what it actually verifies.

Suggest a correction · All posts