This doc states the following:

If you happen to modify the public API of Angular, API golden files must be updated using...

Also this commit has the following heading:

fix: public API golden files #16414

I'm wondering what is usually referred to as "golden files". I've googled around and it seems that this phrase is commonly used.

  • lists.boost.org/boost-users/2013/04/78334.php. It's for some specific tests, where you compare the output of a test to a specific file. – Walfrat Oct 8 '17 at 10:23
  • 1
    In my neck of the woods, we refer to them as "baselines". When a test changes, or an implementation changes, we have to update the baselines to be in line with the new tests or implementations. – user1118321 Oct 12 '17 at 5:05

A "golden file" is the expected output of some test (usually automated), stored as a separate file rather than as a string literal inside the test code. So when the test is executed, it will read in the file and compare it to the output produced by the system under test.

It's not really a very common expression; I have not heard it in 15 years of professional programming, even though I have used such files many times.

  • what is the common name to describe these files? – cowlinator Dec 10 '19 at 3:38
  • 2
    @cowlinator: I don't think there really is one. I just thought of them as "expected output". – Michael Borgwardt Dec 10 '19 at 7:28
  • 2
    A related term I'm familiar with is 'golden data'. This refers to test data that doesn't change. This input is expected to produce the same (or very similar output) when used in a regression test. The term 'golden' probably comes from the fact that gold is a stable substance. – JimmyJames Jan 29 '20 at 16:18
  • 1
    In electronics manufacturing, a 'golden unit' is the best prototype or one of the best/most typical units from the first production run that is set aside for verifying test procedures and for comparing with future units. – Jeanne Pindar Jan 30 '20 at 16:57

In a nutshell, a golden file is a file where we store the output and that will be used by the test as the expected output. This file should be updated any time the output changes for good reason. That's that simple :) .

Once again, introducing and using golden files in our tests is pretty straightforward and easy to use.

I got this useful link.

  • URL link is broken – cowlinator Dec 10 '19 at 3:39
  • @cowlinator -- found alternate host for same author/topic/date link and fixed answer – jefflunt Jan 28 '20 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.