开发者

Unit-testing SharePoint workflows

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 re开发者_如何学运维lease 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.


Unit Testing Workflows? In general unit-testing Sharepoint is rather hard.

I have used two frameworks together with Sharepoint:

  • Typemock
  • MS Pex & Moles

Neither of these frameworks is able to test Microsoft Sharepoint Activities or in particular, Workflows made with SHarepoint Designer as those are sealed and you should consider them "working" anyways - Microsoft made them, they're perfect! :-)

Your library is certainly of great interest as there are not many people trying to unit test Sharepoint due to Sharepoints nature in my eyes: You use lot of built in functionality and just customize and and probably add to that functionality - basically you only want to test/unit test your own code.

Sorry, can't give you specifics on the problems I faced - Typemock was definitely more powerful to use as it is a lot older and mature - Pex&Moles is fun though (I found the tutorial for Sharepoint rather nice: Unit Testing SharePoint Foundation with Microsoft Pex and Mole.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜