This diagram for both single and twin motor locos seems to have been well received on another thread.
Apparently it's not easy to find these diagrams with an internet search so I thought it may be useful to repeat the image here.
Indeed, many people don't just use it for testing, but as a permanent way of feeding power to the loco from a trailing battery car. It's not the best method, but it DOES work and is easy to do.
It should always be remembered that unless the track pickups are also removed or disconnected in some way, as Phil says, then when you're feeding power in via the socket you will actually be feeding the battery power to the whole track!
The plug from the decoder board to the rear socket is usually light blue in colour, unlike the rest of the CT plugs which are usually white. No idea why this is, but it's a useful identifier.