Workflow TV - How to test activities and workflow services with XamlInjection

Download this episode

Download Video


In our last episode I showed you the Contoso HR sample application.  The Submit Application workflow coordinated database updates, sending of email and multiple web service calls.  How can you unit test a workflow like this?  You don't want to update databases and send email when testing but you want to be sure that the conditions and correlation queries are correct.

The WorkflowTestHelper project now features XamlInjection which allows you to inject mock activities into the XAML when testing.  In this episode I'll show you how I tested the Submit Application workflow using XamlInjection.

Ron Jacobs
twitter    @ronljacobs

What do you want to see on






Available formats for this video:

Actual format may change based on video formats available and browser capability.

    The Discussion

    • User profile image

      Its good to see that you guys are making the framework easier to test, it would be great to see you guys work with the third party Mocking guys to enable some of this functionality rather than rolling your own mocking framework.

      There seem to be a bit of fragility in the test two with magic strings.  But looks good.


    • User profile image

      Thanks for the feedback - I hear you. We want to provide ways to work with exisitng mocking frameworks when possible. XAML based workflows are in a special category of thing that other mocking frameworks can't really help you with.  Of course once you cross over into the code of an activity then you can always mock at that level with whatever you like

    • User profile image

      I tried to do the same, but my activity is a slightly more complicated than yours: it contains reference to custom type MyType. I added reference to the type in a unit test project. Nevertheless when I run worflow using your WorkflowInvokeTest class I got an error message: "Cannot create unknown type '{}Variable({clr-namespace:Activity_2}MyType)'. So looks like your class works only for simplest cases when there is no references to any custom activity

    Comments closed

    Comments have been closed since this content was published more than 30 days ago, but if you'd like to send us feedback you can Contact Us.