Flaky test

A test that passes or fails on the same code, depending on timing or chance.

Think of it as A smoke alarm that sometimes goes off when you make toast.

Flaky tests teach a team to ignore red results. The usual cause is a check stricter than the rule you mean, such as comparing health with equality while the character heals. Fix it by asserting the real rule, not by retrying.

Related terms