I do use Lux, and I am expanding my use of it.  Some of my custom actions 
(particular the family that implements vsdbcmd.exe database deploy) have 
complex immediate custom action components (e.g., unpacking the deployment 
engine to a temporary location, building an appropriate command line, and 
setting up a deferred action to clean up the mess).  Lux has been VERY helpful 
in validating the these actions.

By contrast, the deferred actions are purposefully very simple (e.g., call 
vsdbcmd.exe with a previously-built command line).

And that, I believe, is the greatest strength of Lux--it encourages a design 
philosophy where the deferred custom actions are very linear and the logic 
resides nearly entirely in the immediate actions.

--
John Merryweather Cooper
Build & Install Engineer - ESA
Jack Henry & Associates, Inc.(r)
Shawnee Mission, KS  66227
Office:  913-341-3434 x791011
jocoo...@jackhenry.com
www.jackhenry.com 



-----Original Message-----
From: Steven Bone [mailto:sb...@pobox.com] 
Sent: Tuesday, July 31, 2012 7:30 AM
To: General discussion for Windows Installer XML toolset.
Cc: kirann.he...@gmail.com
Subject: Re: [WiX-users] Lux - Custom action testing framework- Advantages?

Kiran - you privately sent me your initial post (not specifying you 
cross-posted to the WiX-users list.  I will reply here publicly and in context 
with your follow-up.

I personally never have used Lux, as it did not exist when I last developed a 
Custom Action of any test-worthy significance (I don't do much installer work 
anymore, but when I do usually the WiX set has what I need).  The value of Lux 
is certainly there, otherwise Rob and crew would not have made it!  *The most 
difficult part of a custom action to test is the immediate part*, where you 
likely read the MSI tables or custom tables and properties and pack all the 
data you need into a single property.  It is comparatively simpler to test the 
deferred/rollback/commit actions using traditional unit testing methodologies 
because their interaction with the MSI APIs are fairly limited (getting the 
CustomActionData and MsiFormatRecord/MsiProcessMessage is almost all they can 
do).

If you write your custom actions with the above fact in mind, testing (and even 
debugging via a simple harness) deferred/rollback/commit actions is quite 
simple.  In your deferred/rollback/commit actions you write some safe 
boilerplate code common to ALL your actions that interact with the MSI API to 
get the value of CustomActionData (and mode/language as necessary) and pass 
that data off as parameters to another function/entry point in your Custom 
Action dll.  Any calls you would make for progress/logging to 
MsiFormatRecord/MsiProcessMessage would be conditioned on having a non-null 
MSIHANDLE hInstall (which is passed in as NULL in you unit tests/debugging 
harness).  Now you can simply test that non-MSI entry point with some known 
good packed data and use your traditional unit tests to validate those results.

In a world without Lux, testing the immediate action that reads normal/custom 
tables and properties and creates the packed data structure really sucks.  
Pre-Lux, I had a test harness script that used a manually created MSI and 
stuffed a (specially compiled) CustomAction dll into the binary table and 
installed the MSI.  The MSI ran the immediate action and (the normally ifdefed 
code) wrote the packed data to a file.  The test harness was responsible for 
making sure the output file was deleted, stuffed the dll into the msi, ran the 
test MSI, compared it with the expected results, then performed cleanup by 
uninstalling the test msi (or running msizap based on its failure state), and 
deleting the output file.
 That was a royal pain in the ass.  Lux is much better and is designed to 
replace that strange ugly test harness.  See the note in the Lux documentation 
regarding the Directory properties - this happened to be a source of pain for 
my simple testing harness when executing it on (some) different machines.

So yes, use Lux, but also test using traditional methods to hit your 
deferred/rollback/commit actions.  Just be sure to impersonate the appropriate 
security context when executing your traditional tests on your 
deferred/rollback/commit actions.

Can you sell it to management?  Like any other product you are trying to sell, 
you need to be able to enumerate your pain points and show how investing in 
unit testing can alleviate them.  If your immediate actions are drop dead 
simple (all but a handful of mine are), perhaps you don't even need Lux, and 
you should focus on the deferred/rollback/commit actions.  Unit testing is only 
as good as the reliability of your test platform and the data you throw at it.  
If nothing else, you can certainly build test sets with Lux much easier than 
without, and if you use it properly (write failing unit tests for cases you 
have seen that fail before fixing the bug), you certainly can assure yourself 
that regressions are unlikely.

Steve

On Tue, Jul 31, 2012 at 5:26 AM, kirannhegde <kirann.he...@gmail.com> wrote:

> *Getting the infrastructure in place to test custom actions is pretty 
> tricky (thus Lux exists).*
>
> Could you please elaborate on this?
>
> If i have to sell this idea to my management, what are the  points to 
> make out in favour of Lux?
>
> Thanks,
> Kiran Hegde
>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat 
landscape has changed and how IT managers can respond. Discussions will include 
endpoint security, mobile security and the latest in malware threats. 
http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users
NOTICE: This electronic mail message and any files transmitted with it are 
intended
exclusively for the individual or entity to which it is addressed. The message, 
together with any attachment, may contain confidential and/or privileged 
information.
Any unauthorized review, use, printing, saving, copying, disclosure or 
distribution 
is strictly prohibited. If you have received this message in error, please 
immediately advise the sender by reply email and delete all copies.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to