Testing motor using an identical motor in regen mode
Interesting idea.  You may find that it's more trouble than it's worth compared to simpler dissipative methods.
An ideal permanent-magnet electrical machine generates a torque that's exactly proportional to the current through the armature, regardless of whether it's acting as a motor or a generator.  So in a perfect world you'd just connect two motors back to back, and you'd load the motor under test by putting a current on the test motor and you'd be done.
This is aided by the fact that if you're driving a motor with a simple H-bridge drive, when you backdrive the motor you get power out of the drive.  However, this regeneration is a problem in a lot of practical applications, which is dealt with by dumping the excess power into a resistor instead of stuffing it backwards out of the drive.  This means that if you're choosing a motor drive for this you need to find one that comes set up to back-drive its supply, or that can be configured to do so.
Real motors have all sorts of losses that reduce the amount of torque for a given amount of current.  Some of these are speed dependent (mostly bearings and wind resistance), some are electromagnetic and current dependent (armatures magnetically saturate), some are electromagnetic and dependent on voltage and speed (armatures have eddy currents).  Moreover, gearboxes are lossy, too.
Up to a point, with two good motors and no gearboxes, you could probably still just connect the motors back to back.  If your test motor drive is connected to the same electrical power rail as your motor under test's drive, then power will flow between them, and the electrical power consumption will be minimized.  For real precision you'll still want to measure, and control for, torque.
With a lot of gear reduction, the losses in the driven gearbox will be so high that you just won't be able to control torque directly.  In this case I think the safest approach would be to make a spring coupler between the test motor and the motor under test.  Measure the torque, regulate the speed of both motors in an inner loop, and control the speed of the test motor to regulate the torque.
Note that this just won't work for (or at least will be very difficult for) a typical worm-gear drive, because you can't back-drive those.  If the gearbox efficiency is 50% or less in the forward direction, then in general it cannot be backdriven at all, and because of the dynamics of friction, it'll be practically impossible to control the speed of the load motor when it's being driven.