  We present a quantum self-testing protocol to certify measurements of fermion
parity involving Majorana fermion modes. We show that observing a set of ideal
measurement statistics implies anti-commutativity of the implemented Majorana
fermion parity operators, a necessary prerequisite for Majorana detection. Our
protocol is robust to experimental errors. We obtain lower bounds on the
fidelities of the state and measurement operators that are linear in the
errors. We propose to analyze experimental outcomes in terms of a contextuality
witness $W$, which satisfies $\langle W \rangle \le 3$ for any classical
probabilistic model of the data. A violation of the inequality witnesses
quantum contextuality, and the closeness to the maximum ideal value $\langle W
\rangle=5$ indicates the degree of confidence in the detection of Majorana
fermions.
