Refactor TestUpgrade and TestDownload main command into method