To dry fire a firearm is to pull the trigger with the gun ready to fire when there is no cartridge in the chamber. In some cases, guns are designed to prevent dry firing and will not allow the firing mechanism to operate with the chamber empty. In most cases, however, the action will succeed.
Dry firing is sometimes done when training to use certain firearms in order to familiarize the shooter with the action of the trigger mechanism, or to carry out full procedure training without the use of ammunition. In some firearms, however, dry firing can cause damage to the gun itself. Rim-fire weapons particularly are sensitive to damage from dry firing, as their firing pins or strikers are intended to fall outside the bore in order to crush the cartridge rim against the chamber edge. They are intended to strike the brass or thin steel of a hollow cartridge rim intended to crush. In some cases, there is no stop or mechanism to prevent the firing pin or striker from traversing the millimeter or two where the cartridge rim is supposed to be, and they will (if dry fired) strike the hard chamber lip. In this case, damage to the firing pin or striker and even damage to the chamber itself can occur. Ask me how I know.
If you are unsure whether it is safe to dry fire any firearm, consult the weapon's manual carefully. If you remain unsure, it's probably better not to try it, especially if it is a rim-fire weapon. If you need to test the firing mechanism of the gun, a simple solution is to load an empty cartridge case into the chamber before firing - this way the action will perform under design conditions without, of course, firing a round. If doing this with a rim-fire, try to first rotate the case so that any existing strikes on the cartridge are not under the firing pin.
As always, treat every gun as loaded at all times. Never point the gun at anyone or in a direction you do not have a clear view of (such as a nearby ordinary wall) when pulling the trigger, whether you've loaded empty brass or not.