Add test helpers to tidy up testing code.