Former South Africa captain Faf du Plessis has announced his retirement from tests to make Twenty20 International cricket his priority with successive World Cups in the next two years.