locked
How do I unit test complex Workflows (WF 4.0) with bookmarks? RRS feed

  • Question

  • I want to create unit tests for several complex workflows that may have bookmarks, may call other workflows (that may have bookmarks as well), etc.

    They are run with workflow service.

    I followed the instructions on http://wf.codeplex.com/wikipage?title=Microsoft.Activities.UnitTesting%20Overview but that doesn't really work. It started with NuGet failing to properly install, adding packages but no references.

    Then I followed the instructions to create a new solution and did not work either, following the steps exactly to create a unit test for an activity without bookmark got me a System.TypeLoadException and following the steps to test an activity that might have a bookmark cannot even compile because the sample code uses the RunEpisode and ResumeEpisodeBookmark methods of the WorkflowApplicationTest  class, but these methods do not exist, at least not in the Microsoft.Activities.Extensions, Microsoft.Activities.UnitTesting or Microsoft.Activities.UnitTesting.Design dlls.

    In fact, I cannot even find something about these methods on google besides links to the article I used originally.

    I would greatly appreciate a help and maybe a link to a sample that works and/or a link to the requires resources to make the above mentioned sample work or maybe a link to an alternate approach (that really works).


    • Edited by Ishiirou Tuesday, September 3, 2013 2:45 PM
    Tuesday, September 3, 2013 2:45 PM

Answers

  • How about this tutorial? http://blogs.msdn.com/b/rjacobs/archive/2010/09/07/how-to-unit-test-wf4-workflows.aspx

    Note you need WF4 Workflow Test Helper from http://archive.msdn.microsoft.com/wfth. This may explain why you're missing some assembly references.

    • Marked as answer by Angie Xu Monday, September 30, 2013 2:12 AM
    Thursday, September 19, 2013 8:41 AM
  • Hi Ishiirou

    "It started with NuGet failing to properly install, adding packages but no references."

    According to your description above, it doesn't install Microsoft.Activities.UnitTesting successfully, perhaps this is the first problem to deal with, I'd like to suggest you to re-do this, and install Microsoft.Activities.UnitTesting again,

    Use Nuget to add it to your project

    • Install NuGet
    • Use the Library Package Manager or Package Manager Console to install Microsoft.Activities.UnitTesting.

    and then follow our msdn document mentioned above to Unit Test WF4 workflow, Name-Dis's tutorials are also good reference for you.

    If it still has same issue, please don’t hesitate to let me know,

    Regards


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by Angie Xu Monday, September 30, 2013 2:12 AM
    Wednesday, September 25, 2013 5:42 AM

All replies

  • Hi lshiirou

    Sorry for the issue that you are hitting now,

    From your description above, it doesn't work fine following the articles mentioned in the link above, first it's recommaned to check the procedures to create unittest with bookmarks, perhaps there is something wrong during you do that, or you could have a try re-do it,

    I think this series of tutorials give detailed description for unit test topic, especially the tutorial below,

    # How do I test an activity with bookmarks

    If you still has the same problem, you could consider submit a request to this site, http://bemis/ContentIdea/default.aspx, I think you can get a positive response there,

    Best regards


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by Angie Xu Monday, September 9, 2013 12:33 AM
    • Unmarked as answer by Angie Xu Wednesday, September 18, 2013 7:48 AM
    Thursday, September 5, 2013 7:36 AM
  • That is exactly the same tutorial I linked to, which uses nonexistent methods.

    They should be in some unmentioned library, but cannot see which one.

    And the second link is broken.

    Friday, September 6, 2013 10:00 AM
  • How about this tutorial? http://blogs.msdn.com/b/rjacobs/archive/2010/09/07/how-to-unit-test-wf4-workflows.aspx

    Note you need WF4 Workflow Test Helper from http://archive.msdn.microsoft.com/wfth. This may explain why you're missing some assembly references.

    • Marked as answer by Angie Xu Monday, September 30, 2013 2:12 AM
    Thursday, September 19, 2013 8:41 AM
  • Hi Ishiirou

    "It started with NuGet failing to properly install, adding packages but no references."

    According to your description above, it doesn't install Microsoft.Activities.UnitTesting successfully, perhaps this is the first problem to deal with, I'd like to suggest you to re-do this, and install Microsoft.Activities.UnitTesting again,

    Use Nuget to add it to your project

    • Install NuGet
    • Use the Library Package Manager or Package Manager Console to install Microsoft.Activities.UnitTesting.

    and then follow our msdn document mentioned above to Unit Test WF4 workflow, Name-Dis's tutorials are also good reference for you.

    If it still has same issue, please don’t hesitate to let me know,

    Regards


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by Angie Xu Monday, September 30, 2013 2:12 AM
    Wednesday, September 25, 2013 5:42 AM