One of the benefits of asp.net mvc is testing. Also multiple templates are available for views. I wonder, why not create some view engine for testing. It will allow to write tests declaratively (like vriting your markup, but adding assumptions and constraints). What do you think, is there any sense for that?
Made some investigations and see that currently poeple are using fake view engines to test their controllers. Here and here are 2 examples of this approach. So in this context I`d say that idea of using views for testing purposes can be said like "Creating a view engine that will ease some default testing procedures".
By easing some testing procedures I assume the following:
Allow default checks, like checking for null, for equality or non equality to some types/objects.
Allow easy access to all things can be used to generate and fill a view. Its model, view data and so on. So that you can just write things like check model contain Customer and his name is John Smith or Products DropDownList has 5 products and allow to write this with some easy syntax. Like Model.Contains(Customer).CustomerName.Is("JohnSmith"), Model.Products.Contains(5). This is the one just came to my mind, I think there are better ways to write down test cases, that`s for sure, but I hope it gives the idea.
Allow to use Views that you already have to generate some tests using them. Would be great to have a kind of WebForms designer that allows you to generate parts of tests using parts of the view. I think this can boost the speed of test writing as you have enough context of what is going on and what need to be tested when see your View.
s not going to be a View as we have views now. Its going to be a view for testing. As unit testing class is also class, but for testing purposes. But do you imagine to say we have classes already and we can test our apps, why do we need unit tests? The main idea is to make it easier to write testing logic. Like what you have with putting controls of aspnet in designer, but for tests. For now you can put lot of things declaratively, why not allow to test in the same way?