Open kenakamu opened 3 years ago
Great question.
FunctionContext
is an abstract class, so you can leverage mock frameworks or implement your test version (one example may be found here ).
We also have plans to release a set of test helpers/test framework for the Worker, but we don't currently have an ETA on that.
/cc @brettsam
Great! Thanks. I will follow the sample to see if I can implement unit test :)
We also have plans to release a set of test helpers/test framework for the Worker, but we don't currently have an ETA on that.
@fabiocav is there a tracking issue for the feature/work to be done? Thank you.
We also have plans to release a set of test helpers/test framework for the Worker, but we don't currently have an ETA on that.
@fabiocav is there a tracking issue for the feature/work to be done? Thank you.
Are there any updates for the test helpers/test framework? I'm struggling to setup unit tests around classes that implement IFunctionsWorkerMiddleware, especially with FunctionContext.
Bump on the updates? :)
Does anyone has any samples or reference docs about How to write unit tests for middleware using mstests v2 and moq for azure functions v4 .net6 isolated?
I have spent a number of days trying to test this. It has involved frequently going back to the source code because every time I think I have something mocked, I discover yet another private interface. In the absence of a good testing guide you really have made this as opaque and difficult as possible 🤬. It has now been over a year and still this seems the only real guide! Is there a better resource available. I am particularly struggling with how to mock FunctionContext and set the bindings and features. Would really appreciate if you could point me to some actual complex samples that don't involve all your internal interfaces.
any updates? currently the old azure function 3.x is being deprecated. We need a mock solution for FunctionContext
Guidance on how to mock FunctionContext
so that the BindInputAsync
extension method works would be appreciated
Great question.
FunctionContext
is an abstract class, so you can leverage mock frameworks or implement your test version (one example may be found here ).We also have plans to release a set of test helpers/test framework for the Worker, but we don't currently have an ETA on that.
so many internal classes in the repo, so others can't do the same thing... the linked example will only work in your SDK
Following as we are experiencing the same issues as described here! Are there any updates whatsoever, @fabiocav and @brettsam?
I tried to search sample or code which explains how to properly unit test isolated process version of Function. Any input are appreciated!