Refactory the tests