refactoring functinal tests