refactoring functional tests