Testing can be either a bit complicated or it can be easy with less precision.
Ideally you would have Peter's OBDII C&C gauge which is capable of measuring the output power from a battery by a simple routine.
But, I think many first buyers won't have the gauge and wonder how to do it with no dedicated instruments.
First, let's talk about the fairly obvious dash signals that a deteriorating battery gives the driver. As the battery ages, primarily from the simple cycling or use, or abuse, the battery cells will become more unbalanced and will start sending signals to the dash display. The first thing the driver will see is an occasional recalibration cycle. The charge level gauge will show a rapid loss of charge to a low level, followed immediately by a gradual increase to full. A poor battery may only drop to a mid charge display before recharging. The frequency of these recalibrations is a rough indication of battery balance. New batteries do not recalibrate. It might be two years before a new a battery starts to recalibrate.
The second level of deterioration is when the regeneration display suddenly starts to show a lot of 4 bar charge cycles while driving at reasonably light load. These cycles have been called mandatory balance cycles. If they occur frequently, then the battery is getting into bad shape.
The third level is when you start getting the IMA warning light. When these start to coming, they can be reset by removing by removing the 12V battery negative terminal for a few second, but they will become more frequent til the point that they occur immediately.
It is widely felt by experienced owners that battery life can be extended, even after the IMA light starts displaying, by grid charging/discharging, but that is a different subject.
So, if you don't have the gauge, take the car out onto a less traveled road and accelerate hard. If the battery energy dies quickly, or if the IMA light displays, then the battery is certainly marginal. REMEMBER that your first responsibility is to your driving and fellow travelers, so be safe. Don't become to distracted. Light traffic helps.
The speed with which a battery recharges after being emptied from hard acceleration is also an indicator. Batteries with little capacity will recharge to full very quickly. It takes several miles to recharge a decent battery.
A new battery will provide strong feeling acceleration for a minute or so at full throttle and then will cut back to lower levels.