Comparison
Contract testvsGolden test
Contract test
the consumer's expectations are recorded and replayed against the provider's build, so nobody breaks the other by surprise.
A test asserting that a provider satisfies the specific expectations of its consumers, run in the provider's pipeline. It catches integration breakage without a full end-to-end environment, which is the trade that makes it worth the setup. It only covers the interactions consumers actually declared.
Full entry →Golden test
you save the current output to a file and the test just checks nothing changed, which is exactly what you want on a legacy refactor.
A test comparing output against a recorded reference. It is excellent for pinning behaviour you are about to refactor and for large outputs no one wants to assert field by field. It goes bad when updating the snapshot becomes reflexive, at which point the test records what the code does rather than what it should.
Full entry →