Refactor test files