Chris Rogers confirmed he will retire from Test cricket after the fifth Ashes Test at The Oval, which will be his 25th match for his country.