A thermocouple is a device that measures temperature by generating a voltage that is proportional to the temperature difference between its two junctions. In a water heater, the thermocouple is used to sense the temperature of the water in the tank and to send a signal to the gas valve to turn on or off the gas flow to the burner.
To test a water heater thermocouple, you will need a multimeter. Set the multimeter to the millivolt (mV) setting. Then, disconnect the thermocouple from the gas valve. Connect the positive lead of the multimeter to the terminal on the thermocouple that is connected to the red wire. Connect the negative lead of the multimeter to the terminal on the thermocouple that is connected to the white wire.