'God intends to test Abraham’s faith, not to have Isaac killed (Gen 22: 1). The test is genuine, not fake. Walter Brueggemann says that this test “is not a game with God; God genuinely does not know. . . . The flow of the narrative accomplishes something in the awareness of God. He did not know. Now he knows.” God’s statement, “now I know,” raises serious theological problems regarding divine immutability and foreknowledge. Many commentators either pass over this verse in silence or dismiss it as mere anthropomorphism. It is often suggested that the test was for Abraham’s benefit, not God’s. It should be noted, however, that the only one in the text said to learn anything from the test is God. Abraham probably learned something in his relationship with God, but that is not the point of the text. If one presupposes that God already “knew” the results of the test beforehand, then there was, in fact, no test and God put Abraham through unnecessary suffering.'
source: John Sanders, The God Who Risks: A Theology of Divine Providence, 50-51. (Kindle Edition)