The ibtilaa' (testing) of the believer is like medicine for him. It cures him from illness. Had the illness remained it would destroy him or diminish his reward and level (in the hereafter). The tests and the trials extract these illnesses from him and prepare him for the perfect reward and the highest of degrees (in the life to come).
Ibn Qayyim Al-Jawziyya