-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable unit testing for Dapr Workflows #1035
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code is fine overall, hooray testing! Just some nit-picks you can feel free to ignore. However, you do have a build issue that you'll need to look into.
Codecov Report
@@ Coverage Diff @@
## master #1035 +/- ##
=======================================
Coverage 69.47% 69.47%
=======================================
Files 162 162
Lines 5432 5432
Branches 585 585
=======================================
Hits 3774 3774
Misses 1518 1518
Partials 140 140
Flags with carried forward coverage won't be shown. Click here to find out more. Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
cb5ed3e
to
e2a0fd4
Compare
Signed-off-by: Chris Gillum <cgillum@microsoft.com>
Signed-off-by: Chris Gillum <cgillum@microsoft.com>
e2a0fd4
to
f9381ff
Compare
* Workflow SDK changes to enable unit testing Signed-off-by: Chris Gillum <cgillum@microsoft.com> * Sample workflow unit testing project Signed-off-by: Chris Gillum <cgillum@microsoft.com> --------- Signed-off-by: Chris Gillum <cgillum@microsoft.com>
Hi Dapr team, @cgillum , In which release version of .Net SDK we have that available? |
@halspang do you know the answer? |
Hi @halspang , Kindly provide the Dapr sdk release where this feature is available. Thanks a lot! |
Description
An early user of Dapr Workflow pointed out that they aren't able to unit test their workflows. This PR addresses that problem by:
WorkflowContext
a mockable abstract base classThe new unit test project isn't meant as an actual test to be run by us, but as a reference for developers so that they can learn how to write their own unit tests for workflows.
Note that the unit test project references the workflow console app sample, so I made many of the types in that sample
public
so that they could be easily tested from another project.I also found a bug while refactoring the
WorkflowContext
- calls toWorkflowContext.SendEvent()
would have resulted in aStackOverflowException
. That is fixed in this PR too.Issue reference
Resolves #1034
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: