Difficult times are from Allah swt to test the believers if they would like to keep their promises under all circumstances.
But, one should always supplicate Allah swt to spare us from hardships. My Shaikh, Hazrat Maulana Hakim Muhammad Akhtar sb RA used to frequently supplicate that ‘O Allah, always bring us happiness and please let us not have to face any hardships and worries.’ He used to say golden words “اللہ تعالی سے مانگو تو بریانی اور راضی چٹنی روٹی پر بھی رہو” means one should supplicate to Allah swt for the best and should be delighted with whatever He bestows us from His Ultimate wisdom.
A hadith provides us clue as to what should one do in order to receive help from Allah swt in case of testing times. What else does a person need if he receives Devine help when he is worried and helpless.
تعرَّف إلى الله في الرَّخاء، يعرفكَ في الشِّدَّةِ
Don’t forget Allah swt in your peaceful and affluent days, He will remember you in your difficult times.
It is a common practice that we turn towards Allah swt when we are in misery and when all hopes are lost. And, we just forget Him when we are celebrating parties, casting evil glances and advances, illicit activities while on Internet and when no one else can see us, etc..
If we keep Him in our hearts and refrain from evils while we enjoy happy moments of our lives, He will come to our rescue when we will badly need Him.