Large spring clamp or large clothes pin. You don't want a lot of tension or the switch could break. I have seen spcial clamps in the tool catalogs. I believe they are called "sanity clamps" so you don't go insane listening to the door chime.
I have some 1 1/2" circle magnets in a metal can with 1/4-20 threads coming off of them (I have no idea what I salvaged them off a long time ago.) I would simply bolt a small piece of flat stock between 2 of these and use them to hold the switch down.
KD or one of the similar company's make a tool for that It is a spring
that goes between the door and the jam. Their are two one squeezes and
one pushes.
If you are using this to troubleshoot the door switch circuit, you could make a bracket that attaches over the door switch using the same screw (or screw hole) that holds it in place. When you tighten the screw, your home-made bracket will press down on the door switch button.