The Starfleet bridge officer examination was a series of tests for Starfleet officers who wished to be able to take command, besides the command officers such as captain, first officer, second officer, and third officer. The test had many stages, but the final exam required the officer to make a choice that sent one person under their direct command to certain death. No one who failed the test could serve as a command officer on the bridge of a starship except in emergency situations.
In 2370, after attending her Starfleet Academy reunion, Deanna Troi felt she was one of the few classmates who had not risen to command level status. This, combined with her experience of being forced into command under pressure two years earlier when the USS Enterprise-D hit a quantum filament, led her to talk to Commander Beverly Crusher, who on occasion took the night watch of the bridge to stay informed of operations. (TNG: "Disaster", "Thine Own Self")
This led Troi to try the test, which Commander Riker administered. The final portion of the test, which also included a question and answer section, was to make decisions in a holodeck simulation. In it, the officer was required to order an officer to sacrifice themselves to save the ship. She failed the final exam several times before Riker informed her that he was canceling the tests, convinced she would not pass - as much as he cared for her, his first duty was to the Enterprise. Troi was furious, but soon his line about being loyal "to the ship" got her thinking, and she ran the test again, this time saving the ship, but only after ordering Geordi La Forge to make a repair in an area where he would be exposed to fatal doses of radiation. When Riker, having realized she would not simply "let this go", entered the holodeck and congratulated her on passing the exam, she realized that its whole purpose was to ascertain whether or not she would be able to send a subordinate, especially a personal friend, to certain death. Having hesitated to make the decision, Troi admitted that she might not be cut out for command, but Riker responded that, having tried every other solution she could think of, then making this painful choice as a last resort, she had done exactly what she had to, and had earned the promotion to commander. (TNG: "Thine Own Self")