The Throttle Position Sensor is the top plug. The bottom plug is the Idle Air Control Motor.
The sensor looks like this:
I don't know hot to test it, but I believe it's a sealed unit, so you can't service it.
When it starts to go bad, the engine will run fine, then start to act up. The engine revs up, down or stalls. Even if you disconnect the battery, the light CEL will disappear and the Jeep may seem to run fine for a short while, but the problem will return.
As I said, it's very easy to change. Just unplug the wires, remove the two screws and it's out.
Good luck.