You are a UI developer, a part of a product development team .The WPF expert. You get your product definition document from the product management and the graphics from the designer, and you sit down to write the application itself. The product you are writing also has a business side. It works against a server, that uses an SQL server database, consumes web services, or perhaps even interfaces with some dedicated hardware. Your product architect goes by all the best practices written in the book. You have defined a “contract” between the client and the server using a C# interface. The contract also defines some data objects that will be passed back and forth between the UI and the server. The communication is done using WCF but you don’t care about it. You are, after all, a UI developer.

You work against an interface

You have an object that hides all these details from you and you work against it. On your side you are a “by the book” guy as well. You use PRISM and MEF and IOC containers and all the other buzzwords like composition and responsibility decoupling and so on. All your view models are Blend friendly so you can design the UI and see what you get in your designer. Its all good. Your architecture is beautiful.  You are already half way into writing your first screen. Its time to see it working, its time to push the mighty F5.

Forgot something?

But wait a minute. you need a server in order for the application to run. The screen you are working on is supposed to present some data, say a list of people. You need a server to provide it. You could patch the application temporarily so that it creates some fiction “people” data but that means that the application you check into the source control will not be using the server properly. You will have to modify the code locally on your machine every time you want to test your work but commit different code to the source control. While this may be a possible solution when the application is small, what happens when you have tens of different components that are all supposed to work together?

So you get somebody from the server team to set up a server for you. He connects you to some development database they are using, and perhaps a test hardware that is connected to some machine on some other room. It’s black magic for you but no matter, It works. But even now, you can only test the application with the data that is already there. Your application behaves a bit differently when there are 5 records of data to present, and when there are 50, but you can’t test it, there are only 5 records in the database. So you set up SQL Server management studio for the first time in your life, get the admin to give you a username and password, Google “how to modify a table in SQL server” to get an example TSQL query and run it to create the data you need. But you are a UI developer, do you really need to be familiar with SQL in order to do your work? Well, sadly now you do. You are resourceful, you managed. You pat yourself on the back and 5 minutes later people from the other room come yelling at you for messing up their database. The people working on business logic are affected by the changes you made, and apparently you did something wrong, and the data is no longer consistent. it takes another 10 minutes to roll it back, and you still can not test the scenario you need to.

Local DB anybody?

So you sit one of the server developers down with you to install a local instance. Now you can modify the data whenever you want. The next day you get the latest version, you compile, and when you push F5 it crashes. Of course it does. The server is in development, the schema has changed and you need to download a migration script and run it against your local database in order to fix the schema. Except the server team did not yet write one. So you delete the database, ask the nice server guy to help you create a new database, enter all the data you had yesterday again, its already noon and you have not yet even started working on your own task. (neither did the nice server guy, BTW). You are a UI developer but 50% of your time is now spent writing SQL queries.

Web services and authentication

The next screen performs log-in and log-out and you want to test the message you get when you log-in successfully. This time there is no local db that can help you. The API works against a web service. You are a very resourceful developer and after an hour or two on the web you find out how to mock an HTTP Service. So you install Fiddler, intercept the HTTP communication with the web service(very resourceful, did I mention?), and compose a different message to mock the scenario you are trying to create. Great! But you are a UI developer, do you really need to be familiar with HTTP, SOAP, and know how to work a sniffer in order to test your development? You also don’t want to keep redoing this whenever you run the application, so you patch up your code to allow you to run the application without having to log-in when you work on other screens. Now you just have to remember to cancel this piece of every time before you check-in…


Now you work on some UI that deals with errors. You have a notification box that swooshes into the screen with a beautiful animation when the hardware is broken. But how do you test it? Do you actually go and kick the hardware until it malfunctions. You are a UI developer, do you really need to come to work with screw drivers?


When you are a part of a team that develops an application, and you are focusing on the client side, you want to be able to run your application without having to worry too much about installing a server (that is being in development stages as well). You want to be able to run specific scenarios, without having to perform complex configuration on server technologies, that you may not even be familiar with (you are after all, a UI developer). I am mostly focused on .net MVVM development (which is a way to say that I develop WPF, Silverlight and Win 8 Store applications) so naturally the examples I give here are all in C# but the same principals may be applied to web UI development in HTML5.

The idea is this

An application (with UI of its own) that mocks the server but leaves you with maximum control over the scenario that it mocks.

The problem is that  the server development is an on going process and a server simulator that implements the API contract will need to be maintained all the time. Also, if you want to have a UI that allows each user to create and run different scenarios, you will have to develop a pretty sophisticated tool. It can’t be an out-of-the-box tool because this piece of software needs to be able to run code with logic that you as scenario developer want to write yourself. But still, you don’t want to write complex UI and a feature rich application just for testing. So what’s the best solution here?

So this is the problem – next, I will try to suggest one possible solution. Stay tuned 🙂