We all need to go to the barber or hairdresser often, and nobody gets infected that way. If that were a normal way of transmission, everyone along the world would be affected.
The ways you can get HIV are:
-Unprotected vaginal/anal penetrations.
-Sharing needles to inject drugs with.
-Mother to child.
Even with traces of blood on that razor, once it's exposed to air, HIV looses its capacity of infecting. It's a different story when we share needles, as the virus is isolated from air and it can be kept alive for longer, and it's injected into the bloodstream.
You didn't have any risk, and that means that no test is needed.
All the best.