You are referring to the Bridge Officer's Test in the episode Thine Own Self.
You take the Bridge Offricer's test in order to qualify to serve on the bridge as the commanding officer, under normal circumstances. We have seen <PERSON> take command of the bridge in the episode Disaster, before she took the test, because it was an emergency situation, and she was still the highest ranked officer able to do so.
The Bridge Officer's Test does not seem to directly correspond with rank. You almost certainly need to take it to be qualified to achieve a certain level of rank, but <PERSON>, as only a Lieutenant Commander, is third ranking officer on the bridge normally, and therefore has surely already taken the Bridge Officer's Test. We have seen him take command of the Enterprise in Gambit Part 2 and Redemption Part 2, although you might argue these were unusual circumstances, in the case of Gambit, in Redemption, <PERSON> receives temporary command of the Sutherland, which is pretty solid evidence he has taken the test.
It is my personal conjecture that Star Fleet functions like real life military where high rank may be achieved while not performing normal officer/commanding duties, if you perform a highly specialized job, such as doctor or counselor, hence the higher rank of <PERSON> and <PERSON> after they took the Bridge Officer's Test.
Finally, I'd like to say that the point of To Thine Own Self was that the Bridge Officer's Test was not easy for <PERSON>. 865
She failed many times, and when she finally passed, she said:
I knew that was part of being in command, and I thought I'd prepared for it. But when the moment came, I hesitated. Maybe you were right, maybe I'm not cut out for this.
As shown in the episode, not everyone chooses to take the Bridge Officer's Test. It requires you to be able to make decisions like sending someone to die. <PERSON>, if he had not taken the test (but as far as I know, there is nothing to show that he hasn't) may have not because he prefers to stay in engineering and not make command decisions.
I will note that we actually have seen <PERSON> command the Enterprise in the episode Arsenal of Freedom, which is likely due to his having taken the Bridge Officer's Test, but as it was an emergency situation with no higher ranked personnel present, it could have been due to the situation, like how we saw <PERSON> take command without having taken the test in Disaster, and so whether he has taken the test isn't entirely clear. 865