﴿أَحَسِبَ النَّاسُ أَن يُتْرَكُواْ أَن يَقُولُواْ ءَامَنَّا وَهُمْ لاَ يُفْتَنُونَ ﴾
(Do
 people think that they will be left alone because they say: "We 
believe,'' and will not be tested.) (29:2)
This is a rebuke in the form of a question, meaning that Allah will inevitably test His believing servants according to their level of faith, as it recorded in the authentic Hadith:
«أَشَدُّ
 النَّاسِ بَلَاءً الْأَنْبِيَاءُ، ثُمَّ الصَّالِحُونَ، ثُمَّ الْأَمْثَلُ
 فَالْأَمْثَلُ، يُبْتَلَى الرَّجُلُ عَلَى حَسَبِ دِينِهِ، فَإِنْ كَانَ 
فِي دِينِهِ صَلَابَةٌ زِيدَ لَهُ فِي الْبَلَاء»
(The people
 most severly tested are the Prophets, then the righteous, then the next
 best and the next best. A man will be tested in accordance with the 
degree of his religious commitment; the stonger his religious 
commitment, the stronger his test.) 
This Ayah is like the Ayah,
﴿أَمْ حَسِبْتُمْ أَن تَدْخُلُواْ الْجَنَّةَ وَلَمَّا يَعْلَمِ اللَّهُ الَّذِينَ جَـهَدُواْ مِنكُمْ وَيَعْلَمَ الصَّـبِرِينَ ﴾
(Do
 you think that you will enter Paradise without Allah knowing those of 
you who fought (in His cause) and knowing those who are the patient) 
(3:142) 
There is a similar Ayah in Surat At-Tawbah. And Allah says:
﴿أَمْ
 حَسِبْتُمْ أَن تَدْخُلُواْ الْجَنَّةَ وَلَمَّا يَأْتِكُم مَّثَلُ 
الَّذِينَ خَلَوْاْ مِن قَبْلِكُم مَّسَّتْهُمُ الْبَأْسَآءُ وَالضَّرَّآءُ
 وَزُلْزِلُواْ حَتَّى يَقُولَ الرَّسُولُ وَالَّذِينَ ءَامَنُواْ مَعَهُ 
مَتَى نَصْرُ اللَّهِ أَلاَ إِنَّ نَصْرَ اللَّهِ قَرِيبٌ ﴾
(Or
 think you that you will enter Paradise without such (trials) as came to
 those who passed away before you They were afflicted with severe 
poverty and ailments and were so shaken that even the Messenger and 
those who believed along with him said, "When (will come) the help of 
Allah'' Yes! Certainly, the help of Allah is near!) (2:214) 
Allah says here:
﴿وَلَقَدْ فَتَنَّا الَّذِينَ مِن قَبْلِهِمْ فَلَيَعْلَمَنَّ اللَّهُ الَّذِينَ صَدَقُواْ وَلَيَعْلَمَنَّ الْكَـذِبِينَ ﴾
(And
 We indeed tested those who were before them so that Allah will know 
those who are true, and will know those who are liars.) 
Meaning, He will make know which are sincere in their claim to be believers from those who are lying. Allah, may He be glorified and exalted, knows what has happened in the past and what is yet to come, and He knows how that which will not happen would have happened if it were to happen. All the Imams of Ahlus-Sunnah wal-Jama`ah are agreed on this. This is the view of Ibn `Abbas and others concerning phrases such as the Ayah,
﴿إِلاَّ لِنَعْلَمَ﴾
(only
 that We know) (2:143). 
Meaning, only to see - because seeing has to do with what is there, but knowledge is broader than seeing, since it includes what is not present as well as what is.
﴿أَمْ حَسِبَ الَّذِينَ يَعْمَلُونَ السَّيِّئَاتِ أَن يَسْبِقُونَا سَآءَ مَا يَحْكُمُونَ ﴾
(Or think those who do evil deeds that they can outstrip Us Evil is 
that which they judge!) 
Means, those who are not believers should not think that they will escape such trials and tests, for ahead of them lies a greater and more severe punishment. Allah says:
﴿أَمْ حَسِبَ الَّذِينَ يَعْمَلُونَ السَّيِّئَاتِ أَن يَسْبِقُونَا﴾
(Or think those who do evil deeds that they can outstrip Us) 
Meaning, "escape'' from Us.
﴿سَآءَ مَا يَحْكُمُونَ﴾
(Evil is that which they judge!) 
What they think is evil.