[wix-users] Unit tests for Managed Bootstrapper

Phill Hogland phill.hogland at rimage.com
Thu Jan 19 10:31:51 PST 2017


I use Microsoft.Pratices.Unity to implement DI and then I create test seams in Event Handlers and anywhere where the Wix objects would be used, so that the logic to be tested is isolated in a submethod, with necessary wix data passed into it from the calling handler (or calling method).  My nunit unit tests don't call the Event Handler but the underlying submethod passing in mocked data that would have come from the wix api calls.  I have used NSubstitue but mostly I just isolate the code to be tested in submethods, and I try to reduce the complexity of any particular method so that the tests are simple and clear.  So the unit tests do not have any dependency on wix objects.  I do not try to run a bundle.exe, to do unit testing, as that seems to me to be contrary to the core concept of unit testing.  I run about 458 tests in a few seconds with each build of the mba dll, without needing to build any of the various bundles which use the mba, a much slower process.


In my XAML I have implemented the automation properties with the hopes of someday working on implementing a framework for integration testing where I would spin up a full build of a bundle to test the UI or some integration behavior.  Others have discussed their approaches to integration testing here a little over a year ago (or maybe in the old archives).  But for my money focusing on DI and clean unit tests which do not have any dependencies has been a far more effective approach.

________________________________
From: wix-users <wix-users-bounces at lists.wixtoolset.org> on behalf of Farrukh Waheed <farrukh1 at gmail.com>
Sent: Thursday, January 19, 2017 1:15:55 AM
To: WiX Toolset Users Mailing List
Subject: [wix-users] Unit tests for Managed Bootstrapper

Hi experts,
I'm writing Unit Tests for our managed bootstrapper and covered only 22% of
the code, i.e. the public methods used to read
BootstrapperApplicationData.xml and some utility methods.

But there is functionality which needs a running process of Bootstrapper,
especially the Engine and related Event Handlers. In addition, the Burn
variables which would be available when it is running.

How to deal with this situation in unit testing? Do I have to launch the
process (myBootstrapper.exe) to achieve this?

Regards

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/
WiX Support | WiX Experts and Resources from FireGiant<http://www.firegiant.com/>
www.firegiant.com
WiX Support | Installation, Development, Deployment | WiX Experts and Resources from FireGiant





More information about the wix-users mailing list