A testimony is often a way of sharing what God has done in a person's life. However, in order to have a testimony there almost always was a test through which that person had to persevere.
It is, therefore, understandable that we are told to rejoice during trials -- not because of the trials themselves, but because of the end result of the trials. In James 1:2-4, we are told, 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. In other words, we can have joy during trials, because we know that they help make us mature and complete -- they refine us into the person God wants us to be.
A few verses later (in James 1:12), we are told the reward of enduring difficult times: Blessed is the man who perseveres under trial, because when he has stood the test, he will receive the crown of life that God has promised to those who love him.
The challenging events that we go through are what refine us and make us more like Christ. Indeed, 1 Peter 1:6-7 says that one of the purposes of going through grief and trials is so that our faith can grow and be proven genuine.
Therefore, a real testimony of growing in faith and becoming like Christ requires going through a test. So, instead of despising your tests and trials, look forward to your testimony; after all, you can't have a testimony without a test.