Add test name check function and cleanup