How do I tell if a transistor is bad?
You MAY have collector and emitter reversed.

If you swap C and E you will usually get a functioning transistor with much lower hfe and generally poorer characteristics.

Transistor pinouts come in all possible variants.

Simple test jig:

On a breadboard where a device can be plugged in - 


Connect collector via 10k to V+ (say 12V)
Connect base via 1 megohm to V+
Connect emitter to ground.
Measure drop across Collector resistor = proportional to collector current.


Now swap C &amp; E and repeat. A large  difference in current gain will be 

evident. 

BUT many DMMs (test meters) have transistor testers built in. Assume C&amp;E. Test. Swap assumed C&amp;E. Test again.



For leaded "jellybean" transistors I use BC337-40 transistors. In modest volume they can often be got for as little as most other sorts and they are excellent for most uses. 500 mA Ic, hfe of 200-600 (from memory). 



IF this is a TIP 31 (and you really really should give us the whole circuit and component details) then this is the pinout: