Life can be hard. It knocks us around. It involves tricky situations, unpleasant people and awkward learning … often about ourselves !
But, almost always, "After the sun the rain / After the rain the sun", as we used to sing at primary school. Give yourself a break. Don't punish yourself for trying. Failure only deserves the name if there's no option to try again. Else it's just LEARNING.
Often, test "failure" is confirmation of something. That you can drive, consistently well (= few Minor Faults on repeated tests). That you currently lack experience (= one or two Serious Faults). That you may need help accepting or expressing how you FEEL: frustrated; angry; let down; like giving up. That's only human. You're human. I'm human. It'd be inhuman not to feel.
So, feel. Embrace that humanity, even when it stings. It'll make you more whole. With broader knowledge of yourself, you'll be a more capable (and kinder) driver. I know: I've had poor mental health. I believe I can now help more because of that. But you don't need to "journey alone". Consider some outside help.