In this paper we use the current and future cosmic microwave background (CMB) experiments to test the Charge-Parity-Time Reversal (CPT) symmetry. We consider a CPT-violating interaction in the photon sector $\mathcal{L}_{\rm cs}\sim p_\mu A_\nu \tilde{F}^{\mu\nu}$ which gives rise to a rotation of the polarization vectors of the propagating CMB photons. By combining the nine-year WMAP, BOOMERanG 2003 and BICEP1 observations, we obtain the current constraint on the isotropic rotation angle $\bar{\alpha} = -2.12 \pm 1.14$ ($1\sigma$), indicating an about $2\sigma$ significance of the CPT violation. Here, we particularly take the systematic errors of CMB measurements into account. Then, we study the effects of the anisotropies of the rotation angle [$\Delta{\alpha}({\bf \hat{n}})$] on the CMB polarization power spectra in detail. Due to the small effects, the current CMB polarization data can not constrain the related parameters very well. We obtain the 95\% C.L. upper limit of the variance of the anisotropies of the rotation angle $C^\alpha(0) < 0.035$ from all the CMB datasets. More interestingly, including the anisotropies of rotation angle could lower the best fit value of $r$ and relax the tension on the constraints of $r$ between BICEP2 and Planck. Finally, we investigate the capabilities of future Planck polarization measurements on $\bar{\alpha}$ and $\Delta{\alpha}({\bf \hat{n}})$. Benefited from the high precision of Planck data, the constraints of the rotation angle can be significantly improved.