Generate test files. Moved scratch.groovy code into a proper class.