加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

windows – 测试自动化:如何模拟电源故障/机器崩溃?

发布时间:2020-12-14 01:59:24 所属栏目:Windows 来源:网络整理
导读:我有一个delphi应用程序,它依赖于SQLite3,这是一个广告宣传为防崩溃的数据库引擎. 到目前为止,我能够使我的整个应用程序防崩溃,但现在我需要模拟残酷的机器重启/电源故障. 显然,为了进行这项测试,每天100次重启我的机器会疯狂/不实用,所以… 我想知道是否有
我有一个delphi应用程序,它依赖于SQLite3,这是一个广告宣传为防崩溃的数据库引擎.

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

显然,为了进行这项测试,每天100次重启我的机器会疯狂/不实用,所以…

我想知道是否有办法以编程方式/自动方式使用VirtualBox(或类似的东西)来模拟电源故障?

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

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

解决方法

在虚拟盒主机上运行它应该可以解决问题

VBoxManage controlvm(vmname)reset / poweroff

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) 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.)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读