What is a flaky test? Name the causes and how to eliminate them.
A flaky test passes and fails without any code change. The usual causes are timing assumptions (hard sleeps instead of waiting for a condition), shared mutable test data, test order dependency, animations, and unstable environments or third-party services. Fixes: wait for explicit conditions, generate isolated data per test, make tests independent and idempotent, stub external services, and quarantine flaky tests rather than rerunning until green.