Reputation: 6483
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.
Upvotes: 0
Views: 131
Reputation: 13457
You might want to have a look at Fitnesse - see http://fitnesse.org. It is an acceptance testing framework that lets you put together acceptance tests in wiki form. This allows tests to be written, understood and executed by business users as well as by developers.
Upvotes: 1