Refactor parts of BaseTest