It all depends what exactly you want to measure.
Checking the claim, not very useful for real life:
If you want to check the claim from the manufacturer, discharge the battery completely at the (constant) current for which capacity is rated, and measure the time until empty. Then throw away your battery because you just did a very deep discharge. Make sure you are in a fireproof environment. Do not try to recharge your battery afterwards.
Estimating your useful capacity:
Plug your device, and measure how long it takes to get down to your "discharged" voltage (usually between 2.7 and 3.3 V, depending how much you value capacity vs lifetime) or the automatic shutdown voltage of your device. If you care about the capacity, measure current during this and integrate it.
If you haven't designed your device yet:
- Estimate roughly the current or power or resistance you expect to draw (choice of current or power depends on if your device will rather draw constant current or constant power or have a constant resistance).
- Discharge your battery at approximately this current or power or resistance, while monitoring the current (and integrate it to get the mAh).
Note that to do discharge tests, there are dedicated testing devices (programmable loads with options to test batteries), but you can also just use a normal programmable load, or even just a (power) resistor. Just make sure you stop discharging before reaching a deep discharge state