locked
Unit Testing with Team Foundation RRS feed

  • Question

  • I have written several custom activities.  I would like to unit test them in some manner.  What is the best approach for this?  I am using Visual Studio with Team foundation and the workflow addins. 

    Currently, the way I have been testing them is creating a workflow that just holds the activity, running the workflow with the desired inputs to the activity, and then comparing the output from the activity to the expected result.  I have been running this through a console app, but this doesn't allow for the test cases to be added to the test suite built in to team foundation.  In addition, if I try and make test cases for the functions that start the workflows, visual studio crashes.

    Thanks,

    Amanda
    Thursday, July 6, 2006 7:49 PM

Answers

  • Amanda,

    any activity can be executed as a workflow, so you can call Createworkflow passing in the type for your activity instead of a wrapper workflow.  You can also pass parameters, just like you do for a workflow, which will set the properties on your activity.  the main issue you will have to deal with is the threading of the runtime.  If you use the default scheduler, your activity/workflow will run on a different thread, which may not play nice with the test tools.  You can use the manual workflow scheduler which works pretty well for testing out the activity itself. 

    HTH,

    Matt

    Thursday, July 6, 2006 9:19 PM