When the people of Israel were hungry in the desert God sent manna to feed them but with some very simple instructions
Each day the people are to go out and gather their daily portion
He did it for a reason
thus will I test them, to see whether they follow my instructions or not.
Many people read this and make the mistake of thinking that it is like a teacher testing me in school. The teacher in school tests me to that the teacher can find out what I have learned, and then give me a grade.
In the case of God, he already knows before the test how I will perform. He does not test me so that he can learn; God tests me so that I can learn.
This "test" was designed to teach two essential qualities trust and self-discipline. Trust is first because if we do not trust that God is looking out for us, then we fall into the trap of believing "I have to look out for myself" and that is the first step on the road to sin.
If the people of Israel truly trusted God then they would gather what they needed for that day, and stop. And so often that is the hardest thing in the world for us, to stop, to do nothing, to be silent, to sit still, to wait, to give only a measured response.
Trust and discipline we cannot learn from a book or in an instant, we only learn them over time by practice.