James 1:2-4 says "Consider it pure joy, my brothers, whenever you face trials of many kinds, because you know that the testing of your faith develops perseverance. Perseverance must finish its work so that you may be mature and complete, not lacking anything."
Last night I was reading in an amazing book called A Heart Ablaze by John Bevere and in one of the chapters it talks about being tested.
He pointed out that when we go through testing it's to allow what's inside us to surface. Good or bad either way it's an opportunity to have a mirror held up to our face to see what we are really made of on the inside. Are we letting the fruits of the spirit define us? Or are we being defined by some sinful nature that we were otherwise ignorant of.
When put into the fire gold is purified because the heat makes every impurity surface so that THEN it can be removed and transformed into it's purest form.
Testing gives us the opportunity to see what we are made of and remove anything that is not like our Jesus.
The Message puts it this way "Consider it a sheer gift, friends, when tests and challenges come at you from all sides. You know that under pressure, your faith-life is forced into the open and shows its true colors. So don't try to get out of anything prematurely. Let it do its work so you become mature and well-developed, not deficient in any way."
So be encouraged if you are going through a testing or trial period because it's an opportunity to make you just like Jesus.