refactor test scripts