Dryfiring a rimfire can be done, but it does run the risk of deforming the firing pin as it slams into the cylinder. If you do it often enough, you may have misfires, as the firing pin does not reach forward enough to cause primer ignition. It really isn't too much about breaking the firing pin, but about denting it to the point it is too short to provide reliable service.
Centerfire pistols are generally ok, with the exception of the Luger design and a few others, but snap caps are the BEST bet. I personally like the Armsport variety, as they are bright red plastic with a brass base and an internal spring that you can see. A quick glance into the pistol confirms the presence of a snap cap. I also have another variety that looks like a brown cartridge. The only difference between it and a real cartridge [from looks] is the color. I always have to triple check to see if it is real or snap cap. Armsport makes a .22 snap cap also, but it is just pure plastic. I have gone through two packets, as the edge just gets mutilated over time, where the spring of a centerfire snapcap absorbs that impact.
We can always get away with more than we should, but I prefer to be careful.