  We consider the problem of certifying binary observables based on a Bell
inequality violation alone, a task known as self-testing of measurements. We
introduce a family of commutation-based measures, which encode all the distinct
arrangements of two projective observables on a qubit. These quantities by
construction take into account the usual limitations of self-testing and since
they are "weighted" by the (reduced) state, they automatically deal with
rank-deficient reduced density matrices. We show that these measures can be
estimated from the observed Bell violation in several scenarios and the proofs
rely only on standard linear algebra. The trade-offs turn out to be tight and,
in particular, they give non-trivial statements for arbitrarily small
violations. On the other extreme, observing the maximal violation allows us to
deduce precisely the form of the observables, which immediately leads to a
complete rigidity statement. In particular, we show that for all $n \geq 3$ the
$n$-partite Mermin-Ardehali-Belinskii-Klyshko inequality self-tests the
$n$-partite Greenberger-Horne-Zeilinger state and maximally incompatible qubit
measurements on every party. Our results imply that any pair of projective
observables on a qubit can be certified in a truly robust manner. Finally, we
show that commutation-based measures give a convenient way of expressing
relations among more than two observables.
