Improve test passing logic