Re:ASP.NET MVC 3 Preview 1 - Razor View Engine
by StrawberryFrog on Saturday August 28, 2010 @10:31AM
(#1641773)
Views are notoriously hard to test - a lot of that comes down to "does it look right", which is not automatable.
The MVC pattern is already a lot more unit-testable than most, since the view is separated from the rest, and data (viewModel) and processing (controller) can be tested without the view.
Re:ASP.NET MVC 3 Preview 1 - Razor View Engine
by nck4222 on Saturday August 28, 2010 @11:13AM
(#1641809)
I probably should have said that as a reply to the Scott Gu article.
From that article: "Unit Testable: The new view engine implementation will support the ability to unit test views (without requiring a controller or web-server, and can be hosted in any unit test project – no special app-domain required)."
I was wondering how that would work, since as you said, they're notoriously hard to test.
Re:ASP.NET MVC 3 Preview 1 - Razor View Engine
by hackinthebochs on Saturday August 28, 2010 @07:51PM
(#1642683)
I think the main point with testable views is that the default asp.net view engine is completely coupled to the asp.net runtime. It was impossible to instantiate a view engine instance and render a view inside the test framework without creating a special app-domain in which to host the test.
I had to wrestle with this just last week, it was a major pain in the ass to work around this limitation.
A fresh start was needed, and it looks great.
It'll be interesting to see how they incorporate unit testing.