We don't always know why God doesn't answer our prayers the way we wish He would. But that doesn't mean He hasn't heard them, or that He hasn't answered them. It simply means He hasn't answered them the way we wanted Him to.
Remember: We see only part of the picture - but God sees the whole. To put it another way, we are limited in our understanding - but He is unlimited. We often think we know what is best - but only God knows what is actually best. That's why we always need to seek God's will when we pray, and not just our own. Jesus taught His disciples to pray, "Your will be done on earth as it is in heaven" (Matthew 6:10). The Bible also says, "This is the confidence we have in approaching God: that if we ask anything according to his will, he hears us" (1 John 5:14).
But perhaps you're right; perhaps God has been testing you by not granting your prayers. If so, what has His test revealed? In all honesty, it may have revealed that your faith isn't as strong as it should be. If so, ask God to increase your faith - and then take steps to strengthen it by filling your soul with God's Word, and learning from other believers.
Make sure above all of your commitment to Christ. If you have never invited Him into your life, or if you aren't sure, open your heart to Him today. Then thank Him for making you part of His family, and ask Him to teach you to pray as you should. God loves you, and He delights to hear the prayers of His children.