I’m developing a web app with MVC 2.0. I’m storing my data in Windows Azure table storage. I’m not using any mocking for my test. The test framework is the default Microsoft Unit Testing that comes with Visual Studio.
At the moment, I’m only testing my controllers: the view names that are returned, the flow when the code jumps from action to action and the view models that are sometimes returned sent to the views.
My approach isn’t TDD: I write a bit of code and then I test it to make sure it passes. I’m just unit testing, not driving my development by testing first.
Am I doing the right thing with my testing: is it enough to just test the controllers?
In terms of what you should be testing, I recommend testing anything that has a branch statement and complex statements. What do I mean by that? You should be testing any code with if/else or switch statement as well as any mathematic calculations, regex, etc. For your application, this may just be your controllers, but may include views, models or any other classes that you have written. Its not uncommon for view models or domain models to contain code that should be tested.