The protagonist is put through a grueling test of character, but it was all a set up. There was never any real danger.
For example, a mentor arranges for a girl to try seducing the married hero. If he says "no", the obvious right choice, he's told he passed. If he says "yes", he's failed and the girl doesn't sleep with him. ("Danger," clearly, is in the eye of the beholder.)
would use magical illusions
or virtual reality
to trick the character. The mentor might even shapeshift.
Here are examples that don't fit any subtype above. Please feel free to put any of these groups in YKTTW.
Person/people being tested originally knew they were being tested, but for some reason don't remember it during the test.
- Alan E. Nourse's short story "Nightmare Brother". A man undergoes a series of nightmarish encounters with deadly opponents, including incredible pain. At the end it's revealed that the whole situation was a virtual reality hallucination to train him to deal with aliens who drive anyone who meets them insane. The test lasts the entire story and the protagonist doesn't know the test is going on while it's occurring - his memories were mostly suppressed while the testing was going on.
- In an Isaac Asimov's story "Ideas Die Hard", three men think they are being sent to the moon. They are informed that every probe that circles to the dark side of the moon vanishes. They get increasingly paranoid and neurotic, then snap when they see that the dark side of the moon is a wood-and-canvas stage prop. Having their image of the universe shattered, they undergo nervous breakdowns. It turns out that the entire trip was a simulation and they didn't have the budget to make anything appropriate for the dark side simulation. The crew is still sent to the squirrel farm, and the guys running the project are very nervous.
- The short story The New Prime by Jack Vance has five seemingly unrelated plots with different characters on different worlds, each facing a situation that in one way or another tests their character. The sixth ties it together—The ruler of the galaxy has been challenged as unworthy, and created the tests to show that he has the necessary skills for the job in greater sum than his opponents. With his memories wiped, he passed each test, but fails anyway, because the judges realize none of his tests dealt with traits like compassion. Instead, they give the title to a fellow who failed all but one test through unsuccessful attempts to resolve conflicts without violence.
- In Greg Egan's Permutation City the initial protagonist repeatedly attempts to download his intelligence into a computer, but the downloaded intelligence always kills itself, so he (the original, human one) brainwashes himself to believe he's one of the downloaded copies, to get a better appreciation of what it's like for them. At least, this is what his devoted girlfriend explains to him when he wakes up after 'deleting' himself. After he repeats the test a few times, she ceases to exist...
- The Twilight Zone TOS episode "Where is Everybody?". A man suddenly finds himself walking down a road, with no idea of who he is or what he's doing there. The Twist Ending is that he's a U.S. Air Force officer taking part in an experiment to determine if he could handle being alone in space on a trip to the Moon. He finally started to Go Mad from the Isolation.
Secret Training - unlike testing, the idea is not to find out what the subject is capable of, but to teach them a lesson.
Anime and Manga
- Inu no Taisho did a very long-term version of this in Inuyasha when he presented his son Sesshoumaru with Tenseiga instead of the powerful weapon that Sesshoumaru wanted. Sesshoumaru spends upwards of fifty years claiming he has no use for a sword that can't kill anyone, but when his anger and sorrow over Kagura's death prompts Tenseiga to gain the capability to be used as a weapon, he learns that his father gave him Tenseiga in order for him to learn to feel compassion for others.
- David R. Palmer's novel Threshold features a man forced to travel across the surface of an alien planet to rescue his girlfriend, learning various psionic abilities in the process. At the end, he learns that the whole situation was a set up to make him learn the abilities. However, the trope ends up getting subverted, because the lesson fails, and he's unable to utilize the abilities. While the aliens learn their abilities through hopelessness and comatose depression, humans need homicidal rage.
- Agatha Christie wrote a series of stories around Mr. Parker Pyne, an expert on human nature who advertised that he could make anybody happy for a fee. Many of his clients, after forking over the fee, found themselves involved in unusual and sometimes dangerous events that, unbeknownst to them, were staged by Parker Pyne in order to supply the experience or mental outlook that would help them to find happiness.
- In a Whateley Universe story, Team Kimba is sent into a sim run where almost all of them end up getting killed. The point was to teach them the lesson 'You can't always win, and you need to stop thinking that you're indestructible' but they ended up taking away the lesson 'As long as you have the right intel, you can always win'.
- In The Pagemaster, Richard learns that everything he went through was a test to get him to face his fears.
- Played for laughs in The Simpsons episode "Homer The Great", during Homer's initiation to the Stonecutters. Homer's trials include repeated paddlings and a blindfolded leap of faith that's 2 feet high (until his comedic obesity cracks the floor beneath him and he falls through of course).