Create test utilities and refactor tests to use them.