Why does life have to be a test? Allah (swt) does say life is a test in the Quran. But does He answer why it has to be a test?
It seems that the answer has been stated explicitly in the following verse: (67:2)
الَّذِي خَلَقَ الْمَوْتَ وَالْحَيَاةَ لِيَبْلُوَكُمْ أَيُّكُمْ أَحْسَنُ عَمَلًا ۚ وَهُوَ الْعَزِيزُ الْغَفُورُ
[He] who created death and life to test you [as to] which of you is best in deed - and He is the Exalted in Might, the Forgiving -