Okay, but in Star Trek Nemesis just before Picard beams over to stop Shinzon from using the weapon, he tells Data that he's in command and not Troi. So why would that happen if she outranks him? Why wouldn't Data take the test anyway?
Troi could have taken that test any time during the previous six years, if she wanted to. Data could take it at any time if he wanted to. He is comfortable where he is, why change things? He's already the second officer.
As to why Data would be in charge ... Captain's discression. Doctor Crusher is also a full commander. She could have been left in charge as well.
Though Troi is a full commander, she is not a "line officer" ... She can step in if she feels the need, but otherwise, her speciality is in the medical field (counseling).
Again, it's the Captain's discression. Picard wanted Data to be in charge while he was away. He can do that. If he wanted to, he could leave an Ensign in charge of the bridge.
Besides, with hostilities going on, the very real possibility that a ship might go boom boom, would it be more logical to have an officer with boom boom and military experience, or Deanna Troi?