I have a Nikon D5200 and I want to test the difference in capacity from my Nikon battery to an aftermarket one. What's the best way to drain the batteries to test them?
Since you are interested in comparing the capacity of batteries, you can switch 'automatic standby' off in your camera settings and let the camera display some image on the screen for a prolonged time (preferably uniform so that you do not observe a screen burn afterwards). Measuring this time is another task.
Alternatively, you can setup interval shooting with flash turned on (preferably with positive power correction) with some low resolution JPEG and manual focusing selected. The number of photos recorded will give you an idea about battery capacity (the number will be around a hundred or two). The shutter has some limited life though and it is up to you to decide whether you need to waste part of it for the experiment. Nikon D5100's shutter is expected to survive at least 100000 actuations but actual shutter life may be much longer or somewhat shorter.
What I did for my Canon battery (and two aftermarket ones): Took them out shooting.
I started with a blank card, and just shot pictures for several days. I kept my other battery in my pocket. It turns out that my aftermarket batteries can shoot 500+ non-flash/live-view pictures, and they seem to actually outperform the stock battery. In any case, I get about 3 days of typical shooting before I need to swap batteries in my Canon T5.