God tested Israel in the wilderness to know what was in their heart, to see if they would keep His commandments or not. He tests for a lifetime in the wilderness of this world. He wants to see what we will do, to see what is in our hearts. He was preparing Israel to go into the Promised Land. He is preparing us for the Kingdom of God.