I would imagine, like everything else, each person might have their own ideas as to why a test is done, but from my own understanding of it a primary reason is as follows:
1. Premise 1 - God is omniscient as a given item in your question.
2. Premise 2 – If God is omniscient then He has total knowledge, or are all knowing as is the popular phrase, as this is the definition of omniscient.
3. Premise 3 – God has a plan for a particular creation, in this case the person. Support for this premise can easily be found in scripture. So the assumption for your question is that we are talking about God as framed in the typical context of a Christian believer and not some other context.
4. Premise 4 – For typical plans, as related to development of human beings, instruction and evaluation are common elements. As support if you look at the educational system in the U.S., which is knowledge, skill, and outcomes plan for children, in order to take a typical human from point A to point B in a development plan, it requires instruction for knowledge and/or skills development and transfer, then evaluation or testing for validation.
5. Premise 5 – Instructional technique has many forms, which can include, lecture, demonstration, hands on exercises, and even the testing process can be used as an instruction method in addition to its normal role of evaluation. In the latter case, one can see as support for this contention something as simple as the video game. Generally, many video games are competitions or tests of the player against the computer. Instruction is given on basic principles only and the competition itself is used as the primary instructional method to develop the necessary or indented knowledge and skills. In this delivery process, no formal test or evaluation is ever given as it is a repeating cyclical process of testing which is used and once the passing conditions are achieved, then this verifies that knowledge and skill have been transferred so no separate validation step is needed.
6. Premise 6 – God, or anyone, is free to choose the instructional method of their liking to teach any individual.
7. Premise 7 – An omniscient being, since they have all knowledge, would know every and all instructional steps necessary for any person to move from point A to point B for any plan for that person.
8. Conclusion – Therefore, for those instances where the God’s plan is for the human to develop in understanding, knowledge, skills, or other, and if God has chosen as He is free to do, a repeating cyclical process of testing as the instructional method, then the point of such a test becomes evident as it is the process that was chosen to achieve an end result of moving the person in question along a develop plan which God has chosen for them.
So in a nutshell, testing a person (i.e., putting them thru a trial or tribulation or hardship) not only determines their level of knowledge, understanding, or skill related to the test, but it also instructs them and improves them and progresses them. With the test being properly designed and executed, it can be used as a method of instruction and not just evaluation. So this would be a valid reason why an omniscient being would put a person through a trial or tribulation as it would be a method to develop them according to a plan.
Taking this concept out of the religious and into the every day, there are numerous instances in my life, where it was easily realized that everything that could be taught in the classroom or with exercise, would never achieve the same end result as the actual experience would. So the teaching could get you close, but to really develop the skill or understanding one would need to go through the experience. As common example, you can prepare all you want for how to deal with the death of a loved one, but only after going through it are you better equipped. You can train all you want for combat and war, but it is the hardship of the trial of being in combat which makes you the best warrior. Etc., etc.