Use Azure development storage from unit tests
by Benjamin Day
If you’re writing an application that’s going to use Windows Azure, you have two options for your persistent data storage (aka your database). Option #1 is SQL Azure which is Microsoft’s relational database in the cloud. Option #2, Azure Storage, is similar to a relational database but is better thought of as “structured storage”. Reasons to choose one Azure storage option over the other, is a discussion that’s outside of the scope of this article but basically comes down to performance and cost.
If you’re writing a Windows Azure application and have chosen to go the Azure Storage route, you get a convenient local version that run on your desktop called Development Storage. Development Storage (DevelopmentStorage.exe) supplies a set of REST-based Web service endpoints that behave exactly the same as the cloud-based, production Azure Storage endpoints. Since development storage runs on your local machine rather than on Microsoft’s servers, you don’t have to pay for your usage.
So, what does this have to do with unit tests?
Well, if your unit tests depend on Dev Storage’s endpoints to be running and active, you need to make sure that DevelopmentStorage.exe is running and properly initialized before the tests start to execute. The problem is that DevelopmentStorage.exe only gets automatically started when you start debugging a cloud application project in Visual Studio. Sure, that’s not the end of the world but it’s kind of inconvenient to manually start it and it’s annoying when you’re suddenly staring a list of unit tests that are all failing.
— Looking for training on Windows Azure & Azure Storage? Check out our Hands-on Windows Azure Application Architecture & Development course.