Refactor test commands