If God is omniscient, then why does He test people?

There are instances in the Bible where God tests people. For instance in Genesis 22:1 it says God tested Abraham. In John 6:6, it says Jesus knows what he is going to do but he is testing Philip. If God is omniscient, then why does He test people?

I think God tests man not because he is not omniscient, but because we are not omniscient. God understands the things that we don’t necessarily understand. God enables us to understand his will, his love through the process and results of his experiments .Take, for example, the sacrifice of Abraham:

1, Help Abraham build up unconditional faith.
Abraham could not explain God’s request, but he believed that Isaac was come from God’s promise. Abraham believed that God could give Isaac to him and Sarah when they could not have children, and also God could raise Isaac from the dead. "By faith Abraham, when God tested him, offered Isaac as a sacrifice. He who had received the promises was about to sacrifice his one and only son,even though God had said to him, "It is through Isaac that your offspring will be reckoned.“Abraham reasoned that God could raise the dead, and figuratively speaking, he did receive Isaac back from death”. Hebrew11:17-19

  1. Abraham himself experienced God’s preparation by experiment
    After Abraham had experienced this test, he experienced" The LORD Will Provide";His knowledge and trust in God went further.

3, Because Abraham was a friend of god and could experience God’s feelings
In the bible, only Abraham is called a friend of God (James 2:23).God had said, “shall I hide from Abraham what I am about to do?”(Genesis 18:17) God would give the Only Son to sacrifice for sinners, so he used the offering of Isaac to let Abraham experience his feelings and show him his plan for redemption. As Jesus said to his disciples, “no longer will I call you servants, because a servant does not know what his master is doing. Instead, I call you friends” (John 15:15).

4, God, through Abraham, communicated the right way to sacrifice
Now in the days of Abraham many nations around him worshipped idols, and gave their children to idols.The gentiles do it like this because they are deceived by satan.The purpose of God’s sacrifice was to tell the world that God did not abandon human beings because of their SINS, but was willing to bear the punishment for their SINS.The sacrifice is a reminder that there will be a savior who will take the burden of their sin and bring their eyes to a redeemer.

God does not test people. People has sin, so they always face many temptation. But God wants them to overcome.

                   Actually, He does test us.

James 1:2-4
Count it all joy, my brothers, when you meet trials of various kinds, for you know that the testing of your faith produces steadfastness. And let steadfastness have its full effect, that you may be perfect and complete, lacking in nothing.

1 Peter 4:12-19
Beloved, do not be surprised at the fiery trial when it comes upon you to test you, as though something strange were happening to you. But rejoice insofar as you share Christ’s sufferings, that you may also rejoice and be glad when his glory is revealed. If you are insulted for the name of Christ, you are blessed, because the Spirit of glory and of God rests upon you. But let none of you suffer as a murderer or a thief or an evildoer or as a meddler. Yet if anyone suffers as a Christian, let him not be ashamed, but let him glorify God in that name. …

James 1:12
Blessed is the man who remains steadfast under trial, for when he has stood the test he will receive the crown of life, which God has promised to those who love him.

Proverbs 17:3
The crucible is for silver, and the furnace is for gold, and the Lord tests hearts.

Hebrews 12:4-11
In your struggle against sin you have not yet resisted to the point of shedding your blood. And have you forgotten the exhortation that addresses you as sons? “My son, do not regard lightly the discipline of the Lord, nor be weary when reproved by him. For the Lord disciplines the one he loves, and chastises every son whom he receives.” It is for discipline that you have to endure. God is treating you as sons. For what son is there whom his father does not discipline? If you are left without discipline, in which all have participated, then you are illegitimate children and not sons. …

Proverbs 3:26
For the Lord will be your confidence and will keep your foot from being caught.

Genesis 22:1-24
After these things God tested Abraham and said to him, “Abraham!” And he said, “Here am I.” He said, “Take your son, your only son Isaac, whom you love, and go to the land of Moriah, and offer him there as a burnt offering on one of the mountains of which I shall tell you.” So Abraham rose early in the morning, saddled his donkey, and took two of his young men with him, and his son Isaac. And he cut the wood for the burnt offering and arose and went to the place of which God had told him. On the third day Abraham lifted up his eyes and saw the place from afar. Then Abraham said to his young men, “Stay here with the donkey; I and the boy will go over there and worship and come again to you.” …

1 Peter 1:7
So that the tested genuineness of your faith—more precious than gold that perishes though it is tested by fire—may be found to result in praise and glory and honor at the revelation of Jesus Christ.

1 Corinthians 10:13
No temptation has overtaken you that is not common to man. God is faithful, and he will not let you be tempted beyond your ability, but with the temptation he will also provide the way of escape, that you may be able to endure it.

Isaiah 41:10
Fear not, for I am with you; be not dismayed, for I am your God; I will strengthen you, I will help you, I will uphold you with my righteous right hand.

John 6:6
He said this to test him, for he himself knew what he would do.

Luke 4:1-13
And Jesus, full of the Holy Spirit, returned from the Jordan and was led by the Spirit in the wilderness for forty days, being tempted by the devil. And he ate nothing during those days. And when they were ended, he was hungry. The devil said to him, “If you are the Son of God, command this stone to become bread.” And Jesus answered him, “It is written, ‘Man shall not live by bread alone.’” And the devil took him up and showed him all the kingdoms of the world in a moment of time, …

More here —> What Does the Bible Say About Being Tested?