If God knows everything why does he test people?

I was always taught that God knows everything. If that is true then why did God test Adam and Eve knowing the outcome?, why did God test Abraham knowing what would happen, why does God test us when he knows what we will do?

Perhaps a sports analogy will work. A coach doesn’t test a player for the coach’s benefit. The coach pushes and tests a player to make the player better or to help the player realize something about himself. In the same way God tests us so that we might discover things about ourselves (both good and bad).

DISCLAIMER: The views and opinions expressed in these forums do not necessarily reflect those of Catholic Answers. For official apologetics resources please visit www.catholic.com.