Test rewriting