开发者

Testing the output of a RazorViewEngine View

Testing the UI has always been one of the difficulties in TDD, but I had gotten the impression that with the Razor ViewEngine in MVC3, it was possible to get the output that would be rendered for a particular view and set of inputs. You could then use string functions such as "Contains()" to verify the presence or absence of particular text that you expect to see in the output.

However, I can't seem to figure out how to do that, at least not without a LOT of mocking and scaffolding code. And I haven't been successful in finding anything on the top by Googling.

Can anyone point me to a link, or give me some pointers before I waste a coup开发者_如何学Pythonle days re-inventing the wheel by writing the scaffolding functions?

Thanks


You may find the following blog post useful. Also testing rendered HTML by views is not exactly something I would call unit test. It's more of an integration test. There are tools which are specifically designed for performing UI tests.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜