Mocking feature in Azure Functions
An essential aspect of developing code is testing. Your code needs to be robust and able to perform.
You can test your function behaviour by using the mocking feature provided through Azure Function Proxies.
In the Azure portal, you navigate to your Function App and select a function. Click proxies in the chosen function and create a new proxy. Next, you provide a name, route template, allowed HTTP methods, and for example choose to override the response when the function is invoked.
Once you have created the proxy, you will see proxy URL you can call with for instance Postman.
By calling the URL with any payload, you will see the 200 response is returned.
Using proxies is a way to mock your HTTP-triggered Azure Functions. The process of creating proxies is straight forward and can be easily be incorporated in a CI/CD pipeline (see Azure Function Proxies for API Mocking). Furthermore, you can create multiple proxies to test various functions in your Function App.
Lastly, you can apply to mock for durable functions. According to the Microsoft docs mocking is supported – see Unit testing for Durable Functions.