There are mathematical correlations which are fairly close. Do a search and youll find them.
The best way is to deplete the battery very slowly. You want to take it from dull state of charge to none over about 20 hours. That should give you Ah if you integrate correctly.
I use something like this to check the capacity of my RC airplane Li-Pos during discharge into a load bank while monitoring voltage.
For Li-Po batteries, you can only use about 80% of the capacity safely. Mine come out pretty close. If I have one getting weak, I can detect it with this test. I usually discharge at around 15 Amps. Most of my packs are rated at 2200 mAh @ 20-30C (around 40 to 60 Amps)I use a high discharge rate because that is how they are used in the application. If the internal resistance is getting too high testing with this method will detect. RC airplane batteries do not have a built in cut-off like cordless tool Li-Po batteries may have.
Recently I ran some of my Dewalt Ni-Cad packs since some of them seemed to be getting weak. I noticed a significant difference in discharge times and capacity down to a fixed cut-off voltage (around 0.9V / cell) between the packs. So some of them were definitely getting weak.
So yes you can test them for capacity by using the correct load and cut-off voltage. Packs with internal cut-off (typically Li-Po) may complicate things a bit.