测试自动化:如何模拟电源故障/机器崩溃? [英] Test Automation: How to simulate power failure/machine crash?

查看:134
本文介绍了测试自动化:如何模拟电源故障/机器崩溃?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个依赖于SQLite3的delphi应用程序,SQLite3被宣传为可防止崩溃的数据库引擎.

I have a delphi application that relies on SQLite3, a DB engine that's advertised as crash-proof.

到目前为止,我已经能够使整个应用程序防崩溃,但是现在我需要模拟残酷的计算机重新启动/电源故障.

So far I was able to make my whole application crash-proof, but now I need to simulate brutal machine reboot / power failure.

很显然,每天进行100次/一次的野蛮重启只是为了进行此测试,这是疯狂的/不切实际的,所以...

Obviously it would crazy/unpractical to brutally reboot my machine 100 times / per day just to conduct this test, so...

我想知道是否有一种方法可以使用VirtualBox(或类似工具)以编程方式/以自动化方式模拟电源故障?

任何其他方法/想法都将受到欢迎,我的目标是确保用户数据永不损坏.

Any other method/thought would be more than welcome, my goal is to make sure my users' data is never corrupted.

PS.该问题适用于Windows XP或更高版本

PS. This question is for Windows XP or later

推荐答案

在虚拟盒子主机上运行此功能可以解决问题

Running this on the virtual box host should do the trick

VBoxManage controlvm(vmname)重置/关闭电源

VBoxManage controlvm (vmname) reset/poweroff

VBoxManage controlvm(vmname)重置对虚拟主机具有相同的作用 按下实际计算机上的重置"按钮时机器:感冒 重新启动虚拟机,这将重新启动并引导来宾 立即重新启动操作系统.虚拟机状态未保存 事先可能会丢失数据. (这等效于选择 GUI的机器"菜单中的重置"项.)

VBoxManage controlvm (vmname) reset has the same effect on a virtual machine as pressing the "Reset" button on a real computer: a cold reboot of the virtual machine, which will restart and boot the guest operating system again immediately. The state of the VM is not saved beforehand, and data may be lost. (This is equivalent to selecting the "Reset" item in the "Machine" menu of the GUI.)

VBoxManage controlvm(vmname)电源关闭对虚拟机具有相同的作用 在实际计算机上拉电源线的机器.同样, 虚拟机的状态未事先保存,可能会丢失数据. (这 等同于在 GUI或按窗口的关闭按钮,然后选择 对话框中的关闭机器电源".

VBoxManage controlvm (vmname) poweroff has the same effect on a virtual machine as pulling the power cable on a real computer. Again, the state of the VM is not saved beforehand, and data may be lost. (This is equivalent to selecting the "Close" item in the "Machine" menu of the GUI or pressing the window's close button, and then selecting "Power off the machine" in the dialog.)

这篇关于测试自动化:如何模拟电源故障/机器崩溃?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆