Why the bridge officer test in "Thine Own Self" was all wrong:
I'm not saying Troi should not have been promoted. She was a competent officer, after all, and it's a perfectly normal phenomenon for competent officers to rank up, when possible. With the sole exception of Data, all ship's personnel either ranked up periodically or were at least offered higher rank (Data should have been, but I don't think THAT is a controversial statement). And, Picard and Riker declined their promotions because their characters were fan favorites, and promoting them would have required one of them to leave the show. My rationale is to explain that firstly, Deanna should not have been tested at all. Secondly, she should not have passed the test.
The test offered in "Thine Own Self" should not have been a prerequisite for commander rank, for one simple reason: it wasn't really about a third pip so much as it was about being assigned a place in the ship's line of command. Deanna and Beverly Crusher were not in said line, regardless of their pip count. If Commander Riker had perished on an away mission, Picard would not have declared either of them first officer in his place. Rather, their subordinate, Lt. Commander Data, would have been acting first officer. And, he would have remained so until Picard either promoted him to Commander and gave him the job for good, or else selected a new first from available Starfleet personnel. Troi and Crusher would have stayed exactly where they were. Medical officers and ship's counselors do the job that they do, regardless of their rank. Because he was in the succession, Data should have received the test Deanna took, whether he was promoted or not.
That explains why she should not have been tested, but she was. And, as part of that examination, Troi was given a test on the holodeck, in which she had to save the Enterprise from destruction... a test that she failed. However, undaunted, she retook the test. And the Enterprise blew up, sort of. Third time's a charm... nope, kaboom, everyone's dead. An unknown number of failures later, Riker lets her know that she just doesn't get it.
But have no fear... after this dark moment, sometimes known to writers as the Big Gloom, the solution finally comes to Troi. She retakes the test again, this time understanding that the key to saving the Enterprise from destruction is to knowingly and cold-bloodedly sacrifice one crew member. This was considered to be passing the test. And in my opinion, it shouldn't have been.
Don't get me wrong, that is not because it was a bad test. Indeed, it was a perfect test. To take command, a person has to be ready to make what Shelby called "the big decisions". She accused Riker of not being able to make these decisions. Riker proved her wrong with three little words (no, it wasn't "I love you", it was "Mr. Worf... fire"). To take command, a person must understand the big picture, and the sacrifices it can entail. To take command, a person has to understand that they and all personnel under their command are expendable in the service of the greater good. However, the way it was used in "Thine Own Self", it was treated as a puzzle to be solved. Deanna Troi only stumbled on the correct solution after hours of pondering and dozens of trial and error iterations. It is unlikely that a real life or death command decision would be so forgiving.
So yes, the test was perfect... but only when used as a test of character, like the fabled (and unwinnable) Kobiashi-Maru test. Used as it was in the episode, it was merely a test of problem-solving skills. And I really don't think that was the point.