I have a cracked tooth. When the dentist taps on the top of the tooth, the tooth doesn't hurt. When he taps on the front I have shooting pain, why?

The combined method. No single test or technique provides the correct diagnosis 100% of the time for vertical cracks. Diagnostic tests to detect cracks include transillumination, staining, CBCT, sleuth test and temporary crown test. The combined method is used in many cases. Take care.
Different. Every situation is different. Likely depends on the anatomy and direction of the crack.
Direction of crack. Depending on the direction of the fracture, putting pressure on the tooth via tapping will cause pain when the impact is made in such a way to cause the fracture to transmit the stimulus to the nerve.