Question

We're undertaking a large project that is focused on delivering automated testing of the software that we produce.

We have a lot of "events" that trigger certain behavior at specific times. Ideally, we would be able to exercise these tests in an automated fashion without the need to move the system clock in intervals to specific points in time.

To that end, I'm wondering if there is a way (with VMWare, or any other virtualization software) to increase the speed of the system clock of the guest operating system. I'm not interested in measuring performance in these tests, only functionality.

Is there anything out there that would allow for this behavior?

Was it helpful?

Solution

It works for VirtualBox:

VBoxManage setextradata "VM name" "VBoxInternal/TM/WarpDrivePercentage" x

where x is the percentage you want (for instance, 200 is doubling, 50 is halving)

You can also more information here, on the section "Accelerate or slow down the guest clock". Regards.

OTHER TIPS

I was able to work around this using the Win32 API SetSystemTimeAdjustment()

This allows you to increase the amount of time added to the system clock for each OS tick interval. It's meant generally for addressing clock skew, but can be used outside of that particular context.

I don't see what the benefits are of testing this in a fast-forwarding VM instead of unit testing the event trigger using a mock implementation of the date/time dependency.

The only thing you "gain" by testing this in a fast-forwarding VM is that you test both the system's and the programming language's date/time implementation, which I think you are save to trust because it is used, developed and tested by so many for such a long time.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top