The Qur’an states: Allah has created death and life to test which one of you is best in conduct.
To each of you We have ordained a code of law and a way of life. If Allah had willed, He would have made you one community, but His Will is to test you with what He has given you. So compete with one another in doing good. To Allah you will all return.
And We will surely test you with something of fear and hunger and a loss of wealth and lives and fruits, but give good tidings to the patient, Who, when disaster strikes them, say, ‘Indeed we belong to Allah, and indeed to Him we will return.’
Alif, Lam, Meem. do people think that they will be left to say, “We believe,” without being tested? We certainly tested those before them. And Allah will clearly distinguish between those who are truthful and those who are liars.
the essential purpose for which humankind was created is the worship of God. God states that He made this life in order to test man so that every person may be recompensed after death for what he has earned.
You will certainly be put to test in respect of your properties and lives, and you will certainly hear many hurtful things from those who were given the Scripture before you and from the polytheists.