Friday, December 28, 2018

Simple workflow to use VirtualBox virtual machine on testing

Virtualboxbuild.md

Simple workflow to use VirtualBox virtual machine on testing

If you want to use VirtualBox virtualmachine for testing you can easily script it like this

  1. Restore virtual Machine to wanted snapshot
  2. Start virtual machine on headless mode
  3. Excute your process
  4. Power off virtual machine
  5. Restore to snapshot

so it would be something like this

"<path to VBoxManage.exe>" snapshot "<virtual machine name>" restore <shapshot name> "<path to VBoxManage.exe>" startvm "<virtual machine name>" -type headless restore <shapshot name> "<path to VBoxManage.exe>" controlvm "<virtual machine name>" poweroff "<path to VBoxManage.exe>" snapshot "<virtual machine name>" restore <shapshot name>

for example

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" snapshot "testmachine" restore Initial "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" startvm "testmachine" -type headless "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" controlvm "testmachine" poweroff "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" snapshot "testmachine" restore Initial

No comments:

Post a Comment