How does one use the Workflow Service Test Host tracking in unit testing? RRS feed

  • Question

  • I am testing a WF4 service.   I am using WorkflowServiceTestHost for the unit testing.   There is a functionality for asserting that stuff does or does not exist in the end-of-test tracking information.

    consider the following unit test code

    WorkflowServiceTestHost host = null;
    using (host = CreateHost())
        var proxy = new ServiceClient(Binding, ServiceAddress);
    // Call receive points in the workflow
        // I would like to assert stuff like the WF did not abort
        // For now, I would just like to assert that there are a 
        // certain number of invocations of a specific activity.
        // I can find no examples of how to call this:
        host.Tracking.Assert.ExistsCount(?????what goes here???);
    How does one call ExistsCount()?   It requests a Predicate<>  but I can find no examples or documentation.

    • Moved by Fred Bao Friday, January 23, 2015 2:35 AM Workflow Related
    Thursday, January 22, 2015 8:26 PM


All replies

  • Hello Molochnik,

    Since this issue is related with WorkFlow, i move it to the WF forum, there are WF experts who will help you.

    The current forum you posted to is used to discuss and ask questions about .NET Framework Base Classes (BCL) such as Collections, I/O, Regigistry, Globalization, Reflection.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, January 23, 2015 2:33 AM
  • Testing WorkflowServices is harder because you have to host the service somehow.  There are several options you can use.

    1. You can host the service in IIS/AppFabric by configuring your project to use IIS
    2. You can try to insure that the local ASP.NET Development Server is started before testing (See my post on the Canonical REST Entity Service for an example).
    3. You can self-host the service

    For more information, please refer to the document:



    • Marked as answer by Pengzhen Song Monday, February 9, 2015 9:48 AM
    Monday, January 26, 2015 10:14 AM