Allah will fulfill the Hopes of the Righteous Allah's saying;
مَن كَانَ يَرْجُو لِقَآءَ اللَّهِ
(Whoever hopes in meeting with Allah,) means, in the Hereafter, and does righteous deeds, and hopes for a great reward with Allah, then Allah will fulfill his hopes and reward him for his deeds in full. This will undoubtedly come to pass, for He is the One Who hears all supplications, He knows and understands the needs of all created beings. Allah says:
فَلَيَعْلَمَنَّ اللَّـهُ الَّذِينَ صَدَقُوا (So Allah will surely know the ones who are truthful - 29:3). It means that through tests and hardships the good and the bad, and the sincere and non-sincere will be differentiated, because if the hypocrites are mixed up with the sincere believers and are not identified, it may create a number of problems. The object of this verse is to elucidate the difference between the good and the bad, and between the sincere and the non-sincere. The expression used for this purpose is that Allah Ta’ ala will find out who are the true ones and who are the liars. Since He knows about every one even before his birth, whether he is a true one or a liar, the sense carried by this expression is that tests and trials are conducted to bring the distinction of good and bad on surface, so that others should also know.
Hakim-ul-Ummah Thanawi (رح) has copied the argument of his Shaikh, Maulana Muhammad Ya` qub (رح) that sometimes people are addressed by descending down to their level of intellect. The common man makes distinction between the sincere and the hypocrites by testing him out. Therefore, according to their approach of understanding Allah Ta’ ala has said that, through various means, We would find out who is sincere and who is not, even though He knows everything from the very beginning.
Tazkirul Quran
Maulana Wahiduddin KhanOn ayahs 3–6
The question of whether a man is a true believer is decided on the basis of how he conducts himself in extraordinary rather than in ordinary circumstances. It becomes clear, on such occasions through a man’s overt actions whether he is in actual fact what he claims to be. Those who prove to be steadfast in their belief and convictions under extraordinary circumstances, will be treated by God as believers in the true sense. To pass the divine test means to become a man of faith by adopting the way of sacrifice, that is to say, to accept and confirm the Truth when people in general reject it; to be staunch in one’s beliefs when people harbour doubts; to be a believer even at the cost of curbing one’s ego; to accept the Truth even when rejection of it does not entail any loss; to spend when restraint would appear to be more prudent; to be steadfast and firm when circumstances warrant fleeing; to surrender when the occasion demands that one save one’s skin; to bow down in submission when there is an occasion for arrogance; to support and co-operate when it amounts to surrendering and sacrificing everything. The inner man is revealed on such extraordinary occasions. Thereafter, no one is left with the opportunity to make fictitious claims about what in actual fact one is not.
Uthmani text of the Madinah mushaf (King Fahd Complex). Translation: Saheeh International. Tafsir via Quran.com.