Refactor the base test case into separate mixins using addCleanup
Also refactor the temp file management.