Golden File Test

Noun · Development

Definitions

  1. A test that compares program output against a saved reference file ('golden file' or 'snapshot'). On first run or with an update flag, it saves the output. On subsequent runs, it diffs against the saved output. Used for testing compilers (expected output), APIs (response format), and CLI tools. More readable than inline assertions for complex outputs.

    In plain English: Testing by saving a known-good output file and comparing future runs against it to catch unexpected changes.

    Example: "Run the compiler test suite with --update to regenerate golden files after the intentional output format change."

Related Terms