Suppose I need new circuit breakers and buy some at a local shop. How do I test them to be sure they haven't been damaged on their way from factory and will do their job when time comes?
There's no good way to do this. You could (in theory) get a spare electrical box, wire it into your main box such that it had access to more current than the breaker under test, and then install the breaker into that spare box, cause a short and watch it trip.
Alternately, you could install the breaker, overload the circuit in question (borrow all the neighbor's vacuum cleaners?) and watch it trip (and hope nothing goes wrong, causing a fire and burning down your house).
The first is annoying, the second is dangerous (because you have no idea if some previous owner used sub-standard wiring somewhere in your house). There is no good option for the homeowner to test these things.
While I don't think we can make too many general statements, we CAN say that the products distributed in the US are subject to various electrical codes and that the manufacturers design so that if they fail, they fail open. Realistically, you've probably got a lot more to worry about from your appliances, than your breakers.
Just buy your breakers from a reputable retailer, check for damage before installation, and you'll almost certainly be fine.