Refactoring creation of test environment