I was wondering if there are any existing solutions for unit-testing Windows Workflow Foundation workflows that run in SharePoint context.
Unfortunately, SharePoint libraries were not designed with possibility of testing or mocking in mind.
Such workflows are usually tightly bound to SharePoint classes that require SharePoint instance to be installed and running, which is absolutely ineffective for testing.
Following is a list of challenges I faced while trying to unit-test an existing workflow:
- Workflows make calls to static SharePoint objects;
- Some
EventArgs
classes that are necessary for mocking are internal to SharePoint assembly; - Workflows may use special SharePoint Workflow Activities which in turn make calls to SharePoint;
- There is no convenient API for starting a workflow in SharePoint context and monitoring its state.
I solved these problems for a certain workflow I had to test using Microsoft Moles and probably will someday release my solution as open source.
Meanwhile, I'm wondering if any of you ever unit-tested SharePoint workflows. If so, I'd like to hear about your solutions to these (and probably some other) problems. I'd also like to know if my library, if I release it, would be of interest to you.
Thanks.