India captain MS Dhoni has retired from Test cricket, effective immediately, to focus on the shorter forms of the game.