Reputation: 9648
I wonder if it's possible to test ASP.net MVC views without pre-compiling the views. I found many example on the internet but none of them could test the view. They could only test the model of the view.
Update
The views are xml template. I have some logic in controller and I want that to get views from the controller.
Upvotes: 1
Views: 675
Reputation: 21713
You can render Razor views standalone using RazorEngine or one of the solutions here. This will give you HTML which you will have to parse.
However, the reason you haven't found any examples of testing views is that few people do it. Views are declarative; they don't have logic. It takes time and effort to develop a test strategy for views. A better strategy might be to move any logic contained in your view into the models where it can be tested easily.
Upvotes: 2