The quranic perspective
The Qur'an (and the Bible) tells the inspiring story of prophet Joseph in chapter 12. Joseph experienced extremely difficult situations from childhood to adulthood. His consistent response to all the challenges was virtue, and a strong trust in God. In the final act of the story, Joseph finds himself in a position of absolute power. The final act demonstrates the true character of Joseph as he chooses forgiveness over vengeance for those that were truly unjust toward him.
To every circumstance, Joseph chooses to trust God. To trust God does not mean to only wait for God (although I believe this is a part of it); it means to never lose heart, and to continue to work hard, to be hopeful, steadfast and brave. This is what leads Joseph to ultimate success in life. In my opinion, the biggest achievement of Joseph is the development of his personality.
Interestingly, in the concluding verses of chapter of Joseph, God is described as "Lateef", the root-word meaning subtle, imperceptible, very clear. This means that God operates in a way that is not immediately perceptible to humans. Think about the gradual growth of a plant; it is imperceptible to humans, but the effects are very clear. The same is true for good and bad deeds; the consequence of good or "evil" actions manifest in the human personality over time.
(I find chapter Joseph to be extremely rich, and it deserves a full analysis at a later time.)
Let us look at some root-words used by the Qur'an about hardship and difficulties in life. One of the words used in the Qur'an about disaster is the word "museebat". Those that speak Arabic and Urdu understand this word to only mean "disaster", however this is not the entire meaning of the word. The word stems from the Arabic root word S-W-B, meaning: Something to come down and reach its destination; a thing which reaches its right place. This meaning has profoundly different philosophical consequences than "disaster".
Next, consider the verse 21:35 in the Qur'an. I have examined every root word used in this verse and have come to a very different understanding than the traditional translation/understanding. Pay close attention to the real meaning of the words "good", "evil", "test" and "trial" as listed below.
Traditional translation: "Every soul will taste death. And We test you with evil and with good as trial; and to Us you will be returned."
My translation: Every soul will experience death. (During this life,) Your real personality shows up when you are facing both easy and difficult times; We will provide you with opportunities to grow and refine your personality; you have to freely choose between that which leads to the stagnation of your personality, or that which leads to the evolution of your personality. Then (after that), it is to Us you will return.
Root for "test" = BLW: The real condition of something to appear, good or bad.
Root for "trial" = FTN: To melt gold to remove impurity, a forged coin, something that appears in reality.
Root for "evil" = SH-R-R: to scatter, disperse, human strength to be spent/wasted.
Root for "good" = KYR: beauty, anything favoured, useful, all types of good.