Origin of term "horsepower"

In the misty corners of my memory there is a vague recollection that someone actually measured the power output of a horse in order to define one horse power.

Do any of you have better memories, or at least better search engines? Can you verify this apocryphal story for me?