Pastor Wayne Braun started his Lenten sermon series entitled, "Cross Purposes". His message on 2/18/18 was "Testing Your Faith" based on James 1:2-4, 12. "Count it all joy, my brothers, when you meet trials of various kinds" James 1:2 James uses the word "when" not "if". According to the Bible, those trials and tests will be of "various kinds". Persecution, suffering we bring on ourselves, suffering caused by others, "Acts of God" (ie. Hurricane Harvey) James wants us to "Count it all ....". You should evaluate your times of trial and testing within the larger context of your faith. Your God is Almighty! Your God loves you! God's purposes are always good purposes.
How do we come to learn all these wonderful things about our God? Through times of testing. That is God's cross purpose in times of testing - that we would learn that He can be trusted!