refactor test envarg parsing