refactor test helper