In a manner of speaking, there are two kinds of tests. These two kinds of tests correspond to two kinds of doubt: the "I don't want to believe" doubt and the "I do want to believe" doubt.
Unbelieving doubt
This is where someone doubts a statement or a miracle because they don't want to believe it. Prime examples are the multiple times where Jews doubted the miracles of Jesus and repeatedly asked Him to show them a sign. In fact, there is this exchange:
John 10:24-25 (NIV)
24 The Jews who were there gathered around him, saying, “How long will you keep us in suspense? If you are the Messiah, tell us plainly.”
25 Jesus answered, “I did tell you, but you do not believe. The works I do in my Father’s name testify about me,
Here, the Jews were called out as completely disregarding all the miracles that Jesus did up to that point, including healing a man blind from birth, which no one had ever done before (John 9:32). There are many other examples in the Old Testament of the Jews scorning the signs God had already shown them, thus angering God and bringing punishment upon themselves. These people doubt because they don't want to believe.
Believing doubt
This kind of doubt is more along the lines of "I want to believe, but I don't think I can/should". The classic example is the demon-possessed boy's father:
Mark 9:21-24 (NLT)
21 “How long has this been happening?” Jesus asked the boy’s father.
He replied, “Since he was a little boy. 22 The spirit often throws him into the fire or into water, trying to kill him. Have mercy on us and help us, if you can.”
23 “What do you mean, ‘If I can’?” Jesus asked. “Anything is possible if a person believes.”
24 The father instantly cried out, “I do believe, but help me overcome my unbelief!”
Very clearly, here is the desire to believe.
There is also occasionally the need to doubt, as in the case of false prophecies, spirits and messiahs:
1 Thessalonians 5:19-22 (NLT)
19 Do not stifle the Holy Spirit. 20 Do not scoff at prophecies, 21 but test everything that is said. Hold on to what is good. 22 Stay away from every kind of evil.
1 Timothy 4:1 (NLT)
4 Now the Holy Spirit tells us clearly that in the last times some will turn away from the true faith; they will follow deceptive spirits and teachings that come from demons.
Matthew 24:24 (NLT)
24 For false messiahs and false prophets will rise up and perform great signs and wonders so as to deceive, if possible, even God’s chosen ones.
And in order to identify these falsities, one must test them...
Conclusion
What's important here is not the existence of doubt, but the attitude associated with it.
1 Samuel 16:7 (NLT)
7 But the Lord said to Samuel, “Don’t judge by his appearance or height, for I have rejected him. The Lord doesn’t see things the way you see them. People judge by outward appearance, but the Lord looks at the heart.”
Testing the Lord is not what matters; what matters is why you're testing the Lord. As a final note, there is one place in the Bible where God actually tells us to test Him:
Malachi 3:10 (NIV)
10 Bring the whole tithe into the storehouse, that there may be food in my house. Test me in this,” says the Lord Almighty, “and see if I will not throw open the floodgates of heaven and pour out so much blessing that there will not be room enough to store it.