How can we measure the quality of a capacitor?
You don't check.  To choose the capacitor, you go to the manufacturer data sheets of the capacitors, which will have the specifications you need to help you choose.

You buy from a reputable distributor, and specify the capacitor you want. That way, counterfeits and substitutions are less likely.