refactor Agent Test