First of all, the idea of being tested only makes sense if you believe that you have a higher power, regardless whether you call it God, your Buddha nature, your divinity, the child of the universe within you, whatever. If you don't have that belief, then who is testing you?
But why would your higher power, who is there to protect you, allow you to suffer? That seems at first blush cruel. We even think that it brings us into these traumatic situations.
But your higher power is not cruel. You live in an incredibly and almost constantly hostile environment that man has created. Your ego-mind has been conditioned by your life experiences in this hostile world, especially in your early formative years, to react and "protect" you through your emotional response to your experiences.
But this obviously has not and does not protect you. Instead, it causes you endless suffering.
Your higher power knows this, and knows that the only way to go through life and experience the peace and happiness that is your birthright is by handing your will and your life over to its care, surrendering your ego to its care – to give up control. Then you will be filled with light and radiate that light, becoming a light unto yourself and others. And the forcefield created by that light cannot be penetrated by your ego-mind, mara, or the devil. And so you will experience peace and happiness regardless what you are confronted with.
So where does the testing come in? And why does the testing never end? There's an apocryphal story about an opera singer in Italy. After she sings a famous aria, she is applauded so much that she sings it again, an encore. This happens again and again. Finally, she thanks the audience but says that she can't sing anymore. And someone from the audience yells, "You'll sing it till you get it right!"
That's what your higher power is doing by testing you constantly. At some point it has faith that you will understand that your only hope of ending your suffering is by giving up your obsession with control and truly say, "Your will, not my mind's," becoming one with your higher power.
Then not only will you be at peace when encountering such situations, but the situations will not arise. By this, I don't mean that you will not encounter such facts; the facts will not change. But it is not the facts that make you suffer, it is how your ego-mind reacts that makes you suffer – that is the situation that will no longer be encountered.
Then you will be able to move forward with your life – without fear, anxiety, or anger – realizing the greatness that is within you.
May you experience peace and happiness.