Using virtual machines for testing software is great. I can try out anything I want, and there’s never any risk of trashing my main dev machine (which avoids hours of lost coding time!). I’ve been using virtual machines since the 1990′s, and frankly I couldn’t develop without them. (I’ve also got a lot of experience running a private cloud of VMs for one of the UK’s fastest-growing tech companies, but that’s a topic for another day or maybe a conversation over a nice whisky at one of the upcoming conferences ;)
Right now, I’m using them to test phix out on multiple Linux distros before release. It’s a sad fact of life that all of the major distros think they can create a better PHP than the folks upstream at PHP.net intended, and that unfortunately means that a default install of PHP on Ubuntu can’t always run the same PHP code as a default install of PHP on Fedora. I found this out the hard way with an early release of phix; now, every release gets tested in a small but growing library of test VMs before I push it up to my public website.
But the best thing of all? You can backup a VM (normally by creating a snapshot), and then rollback to your snapshot in future – resetting your test environment to a known state before you test again. Perfect for this weekend’s task, which has been documenting and double-checking the steps needed to install phix on Linux dev desktops.
I thought it would be useful (to jog my own memory when the Linux distros release their next versions), to write up the steps that I do when I create a new test VM.
- Install Linux distro from latest available ISO image.
- Run the software upgrade tools to make sure the system is fully patched.
- Disable SELinux if it is enabled.
- Make sure gcc and the Linux kernel headers are installed on the system.
- Install VMWare tools (for VMWare Workstation / Fusion) or VirtualBox Addons (for VirtualBox OSE).
- Use Firefox to install Google Chrome.
- Install some useful dev tools: curl and git
At this point, I shut down the virtual machine, and take a snapshot – before PHP is installed. That’s because I need to make sure that phix’s upcoming installer script does the right thing when there is no PHP. If you’re building your own test VMs, you’ll probably want to get Apache, PHP and MySQL installed and your app’s vhosts serving static pages before you snapshot.
What else would you do to a test VM to make it ready to run your tests?