refine test code