In reply to Removed User:
Unless you're a very strong bike rider you're unlikely to get to your max heart rate in a bike-based test. For most people, running is a much better way to do it. However, if you can't do that or simply don't want to then do a test like JLS describes or hit a big hill for a 4-5 minute effort. My max heart rate on a bike is about 190 and anything over 180 feels very hard. In a 30 minute TT I can hold 175 on the ragged edge, but when I'm running I can sustain 180 for 40 minutes and can reach over 200. Basically, unless you've got pretty big legs you won't have enough output to put your cardio system under sufficient stress to hit MHR.
Your maximum heart is exactly that, so whether you drink caffeine or not it should make no difference. The key is to push yourself so hard that you can't hear anything, everything is screaming to stop, you might throw up, you have tunnel vision, etc.... My 'favourite' way is to run a ~15% hill for 3-4 minutes in an attempt to get the strava KOM. Road is best because you don't have to think about uneven ground.
I don't ever train with caffeine because I don't enjoy hot drinks and don't drink coke, etc.. It's also so I can save it for 'I'm out on my arse' moments, where a caffeine gel or a caffeine tab makes a big difference.