Move test logic into Helper module for test code reuse