Instead of testing for a gamemode NBT tag, why don't you use the gamemode selector instead?
/testfor @a[gamemode=adventure]
If you want to mark players, you can use a /scoreboard
command with the selectors set to @a[gamemode=adventure]
.
Before 1.13, it is @a[m=3]
, but as of 1.13, m
was renamed to gamemode
and the argument is now the name of the mode.
Props to @ppperry for notifying me of this.