More refactoring on tests