10 CFR 430.32 - Energy and water conservation standards and their effective dates is the U.S. government standard defining (among other things) how energy consumption of refrigerators is to be tested. The standard references the test procedure AHAM HRF-1-2008, developed by the Association of Home Appliance Manufacturers, an association which "is an ANSI accredited Standards Development Organization, and maintains several standards which are approved by ANSI through the consensus approval process" (Wikipedia).
The standard costs 100 USD to read, but there's a 2003 research paper comparing the standard to the equivalent ISO standards: "Energy Consumption Measurements Using AHAM HRF-1 and ISO 8561". The paper is free to read as the study was done by the government-funded National Institute of Standards and Technology (NIST).
Enclosure:
Each test cell consisted of a non-thermally conductive platform upon which the refrigerator stood, a wall that stands adjacent to the rear of the refrigerator, and two sidewalls that partially enclosed the sides of the refrigerator. All faces of the test cells were painted dull black to minimize the radiant heat to and from the refrigerator during testing.
Refrigerator-freezer setup:
[T]he freezer compartment is left empty, except for the thermocouples used to measure the compartment temperature. Three thermocouples were used for the top-mount units and five thermocouples were used in the side-by-side unit. Three thermocouples were also placed in the refrigerator compartments of each of these units.
The thermostat was set to the median setting for each compartment of the refrigerator-freezer, and it was operated in an environment held at a constant 32. 2 °C (90 °F) until steady state operation was achieved. There is no specified humidity required for these tests [...]
[T]he recorded compartment temperature is the average of the measured temperature from each thermocouple; where the measured temperature is the time averaged temperature from a thermocouple over the duration of the test period.
Test procedure:
The temperatures and electrical energy were then recorded over the duration of the test period. The test period encompasses one defrost sequence and the entire steady operation between two consecutive defrost sequences. Alternatively, if the defrost sequences are separated by more than 14 h of compressor run time; then the classification of this unit is termed "Long Time Automatic Defrost." For this type of refrigerator, the test period is broken into two parts, one part demonstrating steady operation and one part demonstrating the defrost sequence. The first part must be at least 3 h long and encompass a whole number of compressor on/off cycles, and the second part must record all of the events associated with the defrost sequence.
The target temperature for refrigerator-freezers is -15 °C (5 °F), measured in the freezer compartment. If the measured freezer compartment temperature for the first test is warmer than this, then the thermostats are set to the coldest setting for a second measurement. Conversely, if the measured temperature in the freezer compartment is colder than the target temperature, then the thermostats are set to the warmest setting for a second measurement.
Calculating results:
After two measurements have been taken, a plot of energy consumption versus freezer temperatures is generated and a linear fit is produced. The energy consumption value is found from this curve fit as the energy required to produce a temperature of -15 °C (5 °F) in the freezer compartment. Although the relationship between the evaporating temperature and the energy consumption is not linear, this is a good approximation over this small range of operating conditions and is accepted as the industry standard.
Depending on the amount of time over which the test was conducted, this value is then extrapolated out to an annual value.