How often do you practice in front of others? You could try asking people to join you while you practice, or find a public piano and jump on to practice. The idea is to have more experience playing in front of people than just at the recital or test. The more familiar you are with a given situation, the more comfortable/less anxious you're capable of being.
However, some people actually have performance anxiety for their whole lives. Bob Dylan is said to still get anxious before shows and he has literally been on tour since 1988, referred to as the Never Ending Tour. This is a situation that is a little harder to overcome but not impossible. Lots of these people only feel anxious until they get on stage, then they're fine, presumably because they are doing the thing they are comfortable with at that point. For something like this to work, you have to be extremely well practiced, having the piece(s) memorized and not having more than maybe one or two spots that you're not feeling 100% confident in (obviously virtuosic passages may still be concerning due to the sheer difficulty).
Beyond all that, if you can't get your anxiety under control, you could consider speaking with your doctor and getting an anxiety medication for these situations. If you do this, it is very important to take the medication a couple times before the performance(s) to make sure you are entirely aware of how it affects you. Some medications of this type can make you drowsy, which could inhibit your performance, or you may have other side effects. You don't want to be experiencing those side effects for the first time while you're performing.
I did read a story, I believe in the Oliver Sacks book Musicophilia, about a classical performer who always took his anxiety medication before shows. One night he finished his performance and found his pill, which he had thought he had taken, sitting in the green room. After this, he no longer had to take the pill, realizing that it was likely just a placebo.
One thing to realize about this is that anxiety isn't necessarily a bad thing. It's our body communicating with us, reminding us that we're doing something we care about and trying to make sure we're alert and ready. You could attempt to embrace the anxiety with this in mind. Since anxiety can tighten you up, it can be a good cue to stretch out before you perform, which is generally a good idea anyway.
In the end, your solution may be entirely different than what works for others, so it's important to try a few things out and see what works best for you, however, I'd say that getting a prescription should be your last option.