Refactor the test command.