From Papers on Practical Religion:
There is a sense, doubtless, in which trial reveals us to God; makes manifest to Him, what is in our heart. Perhaps someone may object, and say, no, no; we need nothing to make manifest to God what we are, He understands us perfectly. He knows what is in man, and needs not anything to tell Him. True! and yet He says of Abraham, “Now I know that thou fearest God, seeing that thou hast not withheld thy son, thine only son, from me.” And to the Israelites. “And thou shalt remember all the way which the Lord thy God led thee these forty years in the wilderness, to humble thee and to prove thee, to know what was in thine heart, whether thou wouldst keep My commandments or no.” Now God knew that Abraham feared Him, and He also knew how far Israel would keep His commandments, but He did not know as a matter of actual fact, until the fact transpired. He must have the latent principle developed in action, before he could know it as action.