Water heater gas valve problems can be diagnosed by checking the milivolts with a meter, however you can check a gas valve without a meter.
The guide below will show you how a gas valve works and what
it should do and when it should do it. Once you know how it works
you can diagnose the problem.
These valves are also called control valves, gas thermostats, and gas control valves.
The gas valve controls the pilot light and the water temperature
When lighting the pilot, the button on the valve is pressed and a small amount of gas is sent to the
pilot head. After the pilot is lit it will heat the thermocouple.
The thermocouple will send a small electrical current to the control valve.
When the gas valve receives the current, an electromagnet will open a
safety valve and allow gas to continue to flow to the pilot. At this point
the pilot button can be released. The pilot will continue to burn.
There are two probes protruding out of the back of the valve.
The shorter probe is a safety device. If the thermostat malfunctions and
water continues to heat the probe will interrupt the gas flow. It is called
a high limit probe.
The longer probe is the temperature probe. As the water heats and cools a rod inside the probe pushes a lever in the gas valve and cuts the gas on and off according the the temperature setting.

In this pic. you can see the limit and
temperature probe.
This gas valve has the pilot button
integrated into the control knob.
Some valves have separate knobs
for the pilot.

The pilot button on the valve is separate from the control knob.
The control knob must be turned to the pilot position before the pilot button can be pressed.

This control valve is on a newer style
water heater (has a sealed burner
compartment).
Notice its the same type valve as
on the older style water heater in
the picture above.

This is a newer style water heater with an unusual control valve.
Notice the two white wires coming
out of the bottom of the valve.
The wires are connected to a roll-out
switch(thermal fuse). If there is a flash fire in the
burner area this switch will shut the
burner and pilot light off.
To replace this valve you would need an exact replacement in order to wire up the roll-out switch.
A water heater gas valve controls the pilot light, water temperature and it has a
safety limit to shut everything down.
To check the pilot control, follow the lighting instruction on the water
heater. Do not try to light the pilot if you smell gas.
Press the pilot button down and light the pilot.
If the pilot lit but will not stay lit when the pilot button is released the water heater thermocouple
could be the problem.
If the thermocouple has been replaced and it has been properly installed (tip of the probe in pilot flame, thermocouple screwed in tight at the control valve,thermocouple line not kinked) and still the pilot will not stay lit when you release the pilot button then the gas control valve is at fault.
If the pilot will not light at all with the pilot button down check the gas supply.
You have gas and the pilot still will not light, the pilot line or orifice may be clogged.
Water temperatures in a water heater can vary greatly without ever
moving the temperature control.
In a gas water heater where the thermostat is located in the bottom
of the tank, the water at the top of the tank (where water is drawn off when a faucet is turned on)can
be 20 to 30 degrees hotter than water in the bottom.
This is caused by short cycling. What this means is that just enough hot water has been used to cause the thermostat to come on. Cold water has been dumped in the bottom of the tank near the thermostat. So, while this water is heating, the temperature in the top of the tank is rising.
If you find your water much hotter at times this is probably the reason
and not the water heater gas valve.
Ok, with that being said, water heater thermostats can malfunction. If your
water is too hot and you can hear the burner running turn the thermostat
all the way down. If the burner stays on, turn the gas supply off and
replace the gas valve.
If the pilot is lit, you have a tank of cold water, the thermostat turned up and the burner does not fire up, either the burner orifice is clogged or the water heater gas valve is bad.
Remove the burner assembly. The orifice is located at the end of the burner supply line under the burner. Check the burner supply tube also.
A water heater gas valve cannot be repaired. If a valve malfunctions it must be replaced.
If the pilot button does not pop-up when you release it, cut the gas off and replace the gas valve.
If the control knob will not turn don't force it. Replace the valve.
If the high limit has shut the gas valve down the valve must be replaced. It will not reset itself. This will only happen if the thermostat has malfunctioned and the water reaches extreme temperatures, in which case the gas control valve would need to be replaced anyway.
Gas can be extremely dangerous to work with if you're not sure about what your doing. At the same time, its safe to work with if you do know what your doing and follow all safety rules. If you do not feel 100 percent confident and understand safety precautions, please call someone to help you.
Always check gas lines for leaks after reinstalling them. Soap and water works well. Spray it on all connections and watch for tiny bubbles to form. If you do see bubbles tighten the connection and test again.
Before lighting a pilot stand near the water heater to see if you can
smell gas. Kneel near the gas valve and smell for gas.
If you smell gas, find the leak and repair it or call your gas supplier.
Don't try to light the pilot.
Never fire a water heater burner with the access panels off.
Never tap or hammer on a water heater gas valve.
Related pages.
Water heater thermocouple - How to check or replace.
Water heater pilot light - How to light the pilot on older style water heaters.
Hot water heater pilot light - How to light the pilot on newer style water heaters.