Collapse repeated test code.