def __init__(self): vbox.TestDriver.__init__(self); self.sSessionTypeDef = 'gui'; self.oTestVmSet = self.oTestVmManager.getStandardVmSet('nat') # Use the command line "--test-vms mw7x64 execute" to run the only "mw7x64" VM oTestVm = vboxtestvms.TestVm(self.oTestVmSet, 'mw7x64', sHd = 'mw7x64.vdi', sKind = 'Windows7', acCpusSup = range(1, 2), fIoApic = True, sFirmwareType = 'bios', asParavirtModesSup = ['hyperv'], asVirtModesSup = ['hwvirt-np'], sHddControllerType = 'SATA Controller'); self.oTestVmSet.aoTestVms.append(oTestVm); self.sVMname = None
def actionExecuteOnRunnigVM(self): """ Executes the tests in an already configured + running VM. """ if not self.importVBoxApi(): return False fRc = True oVM = None oVirtualBox = None oVirtualBox = self.oVBoxMgr.getVirtualBox() try: oVM = oVirtualBox.findMachine(self.sRunningVmName) if oVM.state != self.oVBoxMgr.constants.MachineState_Running: reporter.error( "Machine '%s' is not in Running state (state is %d)" % (self.sRunningVmName, oVM.state)) fRc = False except: reporter.errorXcpt("Machine '%s' not found" % (self.sRunningVmName)) fRc = False if fRc: oSession = self.openSession(oVM) if oSession: # Tweak this to your likings. oTestVm = vboxtestvms.TestVm('runningvm', sKind='WindowsXP') #sKind = 'WindowsXP' # sKind = 'Ubuntu_64' (fRc, oTxsSession) = self.txsDoConnectViaTcp(oSession, 30 * 1000) if fRc: self.doTest(oTestVm, oSession, oTxsSession) else: reporter.error("Unable to open session for machine '%s'" % (self.sRunningVmName)) fRc = False if oVM: del oVM if oVirtualBox: del oVirtualBox return fRc