Refactor command line tests