VMWare Workstation 7 自动化命令

      VMWare Workstation在自动化测试可以得到很好的应用,原因在于其拥有强大的快照功能,能通过命令行方式方便的执行类似于Ghost的操作,这在准备干净的测试环境时用途非常明显。去年VMWare推出的最新Workstation7为Windows7提供了很好的操作平台,为Windows7的稳定运行提供了保障。

 

1.        命令行启动VMWare Workstation

C:/Program Files/VMware/VMware Workstation/vmware.exe [-B] [-n] [-x] [-X]

[-t] [-q] [-s <variablename>=<value>] [-v] [<path_to_virtual_machine>/<virtual_machine_name>.vmx]

Option

Description

-n

Opens a new Workstation window.

-B

(Windows hosts only) Opens a new Workstation window but hides the sidebar and toolbars. Only the tabs of open virtual machines are shown. Using this option has the same effect as clicking the Workstation icon in the upperleft corner of the Workstation window and choosing Hide Controls from the menu that appears.

-t

Opens a virtual machine or team in a new tab in the existing Workstation window.

-x

Powers on the virtual machine when Workstation starts. This is equivalent to clicking the Power On button in the Workstation toolbar

-X

Powers on the virtual machine and switches the Workstation window to full screen mode.

-m

Starts the program in quick switch mode.

-q

Closes the virtual machine’s tab when the virtual machine powers off. If no other virtual machine is open, it also exits Workstation. This option is useful when the guest operating system can power off the virtual machine

-s

Sets the specified variable to the specified value. Any variable names and values that are valid in the configuration file can be specified on the command line with the -s switch

-v

Displays the product name, version, and build number

<path_to_virtual_machine>

Launches a virtual machine by using the specified virtual machine or team configuration file (.vmx or .vmtm file).

 

2.        vmrun命令行工具:

对于自动化测试有如下实用命令行(-T代表目标类型,后更参数ws代表Workstation):

l   Power Commands:开启、停止、重启、挂起虚拟机

vmrun -T ws start|stop|reset|suspend “path_of_wmx_file”

start,有两个参数gui|nogui,前者是默认参数,参数加在末尾

stop/reset/suspend有两个参数hard|soft,hard代表执行命令前不运行wmtools文件夹中对应的批处理文件,soft代表执行命令前运行批处理文件,参数加在末尾

l   Snapshot Commands:创建、删除、还原快照

vmrun -T ws snapshot|deleteSnapshot|revertToSnapshot “path_of_wmx_file” “snap_shot_name”

Snapshot还有一个命令是listSnapshots,列出所有快照名

l   Record and Replay Commands

vmrun -T ws -gu <user> -gp <pass> beginRecording “path_of_wmx_file” “session_name”

vmrun -T ws -gu <user> -gp <pass> endRecording “path_of_wmx_file”

上述命令配对使用。

l   Guest Operating System Commands

此类型命令较多,摘取部分较有价值的列举如下:runProgramInGuest | runScriptInGuest | listProcessesInGuest | killProcessInGuest | fileExistsInGuest |deleteFileInGuest | renameFileInGuest | createDirectoryInGuest | deleteDirectoryInGuest | listDirectoryInGuest | copyFileFromHostToGuest |copyFileFromGuestToHost | captureScreen

 

更多命令请参考如下文档:

Workstation User’s Manual》for VMWare Workstation 7

Using vmrun to Control Virtual Machines

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值