Going back to Moses, now, and using him for our example: The Israelites had been in Egyptian bondage for centuries; their burdens became unbearable. They cried to God and He heard them, Exodus 2:23-25. In Exodus 3,God appeared to Moses, who had spent 40 years in the land of Midian tending the sheep of his father-in-law. God told Moses to go to Egypt, that He had chosen him to lead his children out of bondage.
But Moses didn't want to go. His excuses were, "who am I?" "who would I say sent me?", and, finally, "They won't believe me." Then God gave him two signs: The first was Moses' rod. In Exodus 4:2, God said, "What is that in thine hand?" He said, "A rod." And He said, "Cast it on the ground," and he cast it on the ground, and it became a serpent; and Moses fled from before it. And the Lord said to Moses, "Put forth thine hand, and take it by the tail ... " I'm not planning to pick up
a snake, but I'll guarantee you one thing: if you're going to pick one up, by the tail is not the way to do it. But Moses did, "and it became a rod in his hand." Verse 5 gives us our purpose for miracles: "that they may believe that the Lord God of their fathers, the God of Abraham, the God of Isaac, and the God of Jacob, hath appeared unto thee."
The other miracle was for the same purpose. God told Moses to put his hand in his bosom, then draw it out, When he did, it was leprous. He told him to put his hand in his bosom again, and draw it out. This time it was as the other flesh. Then, in verse 8, God said, "if they will not believe thee, neither hearken to the voice of the first sign, that they will believe the voice of the latter sign.
This is as clear and concise a statement as to the purpose for miracles as can be found.
Miracles were never used to "test" God. We must study our bibles and search out the truth to show our selves approved so that we really get to know our God.