Refactore the tests