I am starting to do some installer work using WiX (yay, not Installshield开发者_JAVA百科) and I was hoping to do some TDD of the installer. Does anybody know of an easy way to do this?
It sounds to me more like an integration test than TDD.
As far as i can tell there are no MSI testing suits per se.
Nevertheless you could try something like this ( assuming you have a contiunous integration server):
- after successful build, install MSI on a clean virtual machine - if installation fails do something (mail, ticket, whatever)
- run whatever integration tests you have on your project
After that you can be sure that installed application does what it should.
Does it make sence, if you create some script file that checks that files are on the right places. I expect make it as perl or python script
test_installer_wix.pl
msiexec /x product.msi # remove
msiexec /i product.msi /silent # install
ASSERT_EXIST_FILE(PFILE, 'productname/application.exe')
ASSERT_REGKEY_EXISTS()
and etc.
I want to add link to post about how to create unit test for WIX installer
database: http://miroslawmiodonski.blogspot.com/2012/10/how-to-create-unit-test-for-wix.html
It might not be a bad idea to run a few standard tests on a generated MSI. MSI files support a lot of different deployment scenarios: admin install to extract files, advertised install for active directory, silent install, maintenance install, uninstall etc... Maybe it is indeed an idea to create a small test suite for this - perhaps it's even being considered for the WIX toolset for all I know.
However, I think the first, best step towards delivering a quality setup would be to run the MSI through the MSI validation suite. These are referred to as ICE (Internal Consistency Evaluators) and they are delivered as *.cub file with the Windows Installer SDK. Running these scripts tend to reveal lots of bad design constructs in the MSI. The WIX tool for this is called smoke.exe.
精彩评论