Unit Testing Pipeline Components
It seems like all I ever post about is pipeline components, but I've got some pretty heavy pipeline work to do over the next few months, so I knocked up a simple pipeline component unit testing framework.
Its a lot easier than I could have hoped to spoof the executing context of a BTS2004 pipeline. My initial plan was to decompile pipeline.exe in the SDK (as it does exactly what I want - runs a pipeline out of BTS), but it became immediately obvious that everything I needed was provided and nicely exposed by PipelineObjects.dll in it's root folder. So that concrete implementation of IPipelineContext and IBaseMessage that was going to be so crucial in fooling a standard pipeline component to run Execute(IPipelineContext, IBaseMessage) was just a new away.
The rest wrote itself really. I'm left with a class that takes an instatiated Pipeline component, and calls Validate() on it to check you've also remembered to set all its props. It then passes a string you give it as a message, and lets you know the output for unit testing. Its proper bo!
Its a lot easier than I could have hoped to spoof the executing context of a BTS2004 pipeline. My initial plan was to decompile pipeline.exe in the SDK (as it does exactly what I want - runs a pipeline out of BTS), but it became immediately obvious that everything I needed was provided and nicely exposed by PipelineObjects.dll in it's root folder. So that concrete implementation of IPipelineContext and IBaseMessage that was going to be so crucial in fooling a standard pipeline component to run Execute(IPipelineContext, IBaseMessage) was just a new away.
The rest wrote itself really. I'm left with a class that takes an instatiated Pipeline component, and calls Validate() on it to check you've also remembered to set all its props. It then passes a string you give it as a message, and lets you know the output for unit testing. Its proper bo!
2 Comments:
Can you share the code with the community. I am using pipeline.exe but it sounds like you have a lighter version of it.
thanks,
gena.
By Anonymous, at 9:08 pm
Hi Ben,
Just hit the same problem here at work in that we need to test some custom pipeline components. Would be very interested in seeing the utility class that you've created for doing this.
Cheers,
Nick
By Anonymous, at 11:13 am
Post a Comment
<< Home