refactor functional test.