Can we unit test View ('V') of MVC?

后端 未结 5 678
走了就别回头了
走了就别回头了 2021-01-12 05:17

Duplicate: Unit Testing the Views?

Is there any way to unit test View? I am sure that we can test Model & Controller but don\'t know

5条回答
  •  攒了一身酷
    2021-01-12 05:30

    From what I have read (in Pro ASP.NET MVC Framework by Steven Sanderson), views are not considered worth testing. ASP.NET MVC viewes can be generated using various engines, e.g. the default lightweight ASPX, or for example http://www.stringtemplate.org/. For ASPX output you might run some HTML syntax checker tool, and for other view engines the fact that the views compile successfully should be a good enough test ;)

提交回复
热议问题