Is there a mocking framework for Azure similar to LocalStack for AWS? Please understand that I am not looking for a SDK mock but a resource stack mock.
So much so, that I could replace the configurations of my local Azure stack with actual Azure resources in my project and the functionality would remain just the same. Quite like how it works with Localstack.
I have found Azure Cloud Fabric to come closest to this, but it is tightly coupled with Visual Studio IDE.
LocalStack is a cloud application development tool that provides an easy-to-use test/mock system. It creates a testing environment on your local computer that emulates the AWS cloud environment in terms of functionality and APIs.
Is Azure the same as AWS? No, Azure is a cloud platform introduced by Microsoft in 2010, whereas AWS is another cloud platform introduced by Amazon in 2006. While both the platforms have similar use cases and are prevalent in the Big Data community, their parent companies are not the same.
Azure Stack is a portfolio of products that extend Azure services and capabilities to your environment of choice—from the datacenter to edge locations and remote offices. Build and deploy hybrid and edge computing applications and run them consistently across location boundaries.
Azure Functions is the primary equivalent of AWS Lambda in providing serverless, on-demand code.
Although there is not an equivalent of LocalStack for Azure, Microsoft publish three emulators you can run locally to help with integration testing:
Azure Functions Core Tools, a local version of the Azure Functions Runtime, allowing you to execute your Azure functions locally without deploying them.
Azure Storage Emulator, a local emulator of Azure storage.
Cosmos DB Emulator, a local emulator of CosmosDB.
The above three can get you a lot of integration test coverage, however since Azure Functions, AWS Lambda and most modern web stacks even non-serverless have moved to consuming services rather than just consuming software modules, the only way to have complete parity between integration test and production environments is to automate the creation and tear-down of real, paid for services.
A recipe for End to End/Integration testing on Azure:
The above approach relies on real services to provide testing rather than emulated ones, testing something that's pretty close to what you deploy in production. It will incur usage fees each time you run your tests. If this is a problem, use unit testing and emulator integration testing first in the pipeline and add a human check/different pipeline for this level of testing which you only perform before pushing to production.
Azure Slots may also be worth looking up.
There is now https://github.com/azure/azurite providing also a docker https://hub.docker.com/_/microsoft-azure-storage-azurite
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With