Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are some strategies for unit testing workflows in WF 4?

I've done quite a bit of WF development using 3.5 over the last few years, but am just now ramping up on WF in 4.0. I have a TDD bent, and while WF 3.5 was difficult at times to unit test, I'm wondering if anyone could share their strategy for unit testing workflows in WF 4 and/or point me to resources that would help get me started?

like image 378
Brandon Satrom Avatar asked Jan 22 '23 20:01

Brandon Satrom


2 Answers

The easiest approach is, just like in WF35, to separate the implementation from the activity so they can be tested independently of each other. The activity extension is just a regular class so use whatever you are comfortable with. Most activities can be unit tested quite easily using the WorklfowInvoker.

like image 159
Maurice Avatar answered Jan 24 '23 09:01

Maurice


I completely agree with Maurice on testing activities independently. For unit testing workflow services, there is now Microsoft.Activities.UnitTesting. Download from the CodePlex page.

like image 34
TrueWill Avatar answered Jan 24 '23 11:01

TrueWill