Refactored agent tests to prevent duplicated test execution