Refactoring functional tests