views:

800

answers:

4

Do you do automated testing on a complex workflow system like K2?

We are building a system with extensive integration between Sharepoint 2007 and K2. I can't even imagine where to start with automated testing as the workflow involves multiple users interacting with Sharepoint, K2 workflows and custom web pages.

Has anyone done automated testing on a workflow server like K2? Is it more effort than it's worth?

+1  A: 

I'm having a similar problem testing workflow-heavy MOSS-based application. Workflows in our case are based on WWF.

My idea is to mock pretty much everything that you can't control from unit tests - documents storage, authentication, user rights and actions, sharepoint-specific parts of workflows for sharepoint (these mocks should be thoroughly tested to mirror behavior of real components).

You use inversion of control to make code choose which component to use at runtime - real or mock.

Then you can write system-wide tests to test workflows behavior - setting up your own environment, checking how workflow engine reacts. These tests are too big to call them unit-tests, still it is automated testing.

This approach seems to work on trivial cases, but I still have to prove it is worthy to use in real-world workflows.

Sergey Volegov
A: 

We've just today written an application that monitors our K2 worklist, picks up certain tasks from it, fills in some data and submits the tasks for completion. This is allowing us to perform automated testing, find regressions, and run through as many different paths of the workflow in a fraction of the time that it would take people to do it. I'd imagine a similar program could be written to pretend to be sharepoint.

As for the unit testing of the workflow items themselves, we have a dll referenced from k2 which contains all of our line rule and processing logic. We don't have any code in the k2 workflows themselves, it is all referenced from these dlls. This allows us to easily write unit tests on them to test all of the individual line rules.

Matthew Steeples
+1  A: 

Here's the solution I use. This is a simple wrapper around the runtime that allows executing single activity, simplifies passing the parameters, blocks the invoking thread until the workflow or activity is done, and translates / rethrows exceptions if any. Since my workflow only sends or waits for messages through a custom workflow service, I can mock out the service to expect certain messages from workflow and post certain messages to it and here I'm having real unit-tests for my WF! The credit for technology goes to Michael Kennedy.

zvolkov
+1  A: 

If you are going to do unit testing, Typemock Isolator is the only tool that can currently mock SharePoint objects.

And by the way, Richard Fennell is working on a workflow mocking solution here.