Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

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

Download

Right click “Save as…”

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
blog        http://blogs.msdn.com/rjacobs
twitter    @ronljacobs

What do you want to see on endpoint.tv?

 

Tags:

Follow the Discussion

  • 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.

    Cheers

  • Ron Jacobsrojacobs Ron Jacobs

    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

  • alexalex

    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 '{http://schemas.microsoft.com/netfx/2009/xaml/activities}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

Remove this comment

Remove this thread

close

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.