How can life be a Test if God is all-knowing?
If God knows everything, what is the point of testing humans in this temporary life?
The actual reason behind this set up of trial and test in the worldly life by Allah SWT is not that our Creator did not have knowledge about humans. As a matter of fact it happens exactly like this in the worldly matters too that we take an exam to thoroughly get to know someone. Therefore, Allah SWT The Most Wise has adopted the same interpretation. He SWT has done so in order to make it easy for us the humans to understand and comprehend. It does not at all mean that He SWT wanted to know Himself and was not aware in the first place.
The reason behind the scheme of test in this world is to make evident the qualities of good people in front of everyone. The purpose of the grand assembly on the day of judgement would be to show the excellent qualities of righteous ones making them manifest to humanity that how this person behaved and dealt in the time of hardships and odd circumstances. How he stayed steadfast and God conscious even in times of trials, tests and hardships. The wisdom is clear that God wants to make it evident to other people so that they witness and see for themselves in this temporary life.
These decisions about eternal life are extremely important where someone would end up in eternal bliss and contentment while someone else would end up in eternal torture and punishment. No one that day should be left with a reason to blame their Master that He SWT has sent some undeserving to Paradise. Hope it clears the doubt In Sha Allah.