According to the "no-hair" conjecture, a Kerr black hole (BH) is completely described by its mass and spin. In particular, the spin-induced quadrupole moment of a Kerr BH with mass m and dimensionless spin χ can be written as Q=-κm3χ2, where κBH=1. Thus, by measuring the spin-induced quadrupole parameter κ, we can test the binary black hole nature of compact binaries and distinguish them from binaries composed of other exotic compact objects, as proposed in [N. V. Krishnendu, K. G. Arun, and C. K. Mishra, Phys. Rev. Lett. 119, 091101 (2017).PRLTAO0031-900710.1103/PhysRevLett.119.091101]. Here, we present a Bayesian framework to carry out this test where we measure the symmetric combination of individual spin-induced quadrupole moment parameters fixing the antisymmetric combination to be zero. The analysis is restricted to the inspiral part of the signal as the spin-induced deformations are not modeled in the postinspiral regime. We perform detailed simulations to investigate the applicability of this method for compact binaries of different masses and spins and also explore various degeneracies in the parameter space which can affect this test. We then apply this method to the gravitational wave events, GW151226 and GW170608, detected during the first and second observing runs of Advanced LIGO and Advanced Virgo detectors. We find the two events to be consistent with binary black hole mergers in general relativity. By combining information from several more of such events in future, this method can be used to set constraints on the black hole nature of the population of compact binaries that are detected by the Advanced LIGO and Advanced Virgo detectors. © 2019 American Physical Society.