Make improvements to test code

Refactoring test codes :ship: