Do you have Kwikee or Coach Step steps? The reason it matters is Kwikee uses NC (Normally Closed) magnetic switches and Coach step uses NO (normally Open). This refers to the state of the switch when the magnet is held close to the switch.
Also, the switch may start working if tapped, though you still should get a new one.
Here is a thread which explains this.
These can be bought on eBay for a few bucks if you're willing to have a different color (my replacement was $3 on eBay in 2011,
here's one for less than $3 that will do both NO and NC if you can wait a month to get it)