Refactor some 'generate' tests to use shared setUp/tearDown code.