Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Asp.net MVC View Testing?

With more and more code pushed to the Views in Asp.Net MVC (i.e. AJAX, JQuery, etc...), how do you maintain the 'testability'?

  • How do you test your Views?
  • How do you test your views with client-side jscript code?
  • How do you test your Views with Async behavior?

It seems that most examples on the testability of MVC deal with controllers. What about Views?

like image 602
Peli Avatar asked Oct 01 '08 04:10

Peli


People also ask

What is MVC in testing?

Model View Controller or MVC is a design pattern that encourages you to organise your code in a way that is easy to understand and manage. Each layer of code handles only one specific task in one specific area.

How does MVC enable ease of unit testing?

The ASP.NET MVC Framework makes it easy and natural to unit test application functionality. It also enables a Test Driven Development (TDD) workflow that enables test-first based development.


2 Answers

Selenium is a great tool for testing the front end of any web app. It is written in the browser's native language, JavaScript. Having the browser run the test framework code gives your tests the ability to expose browser incompatibility issues. It is free and open source.

like image 119
Kyle Dyer Avatar answered Sep 30 '22 19:09

Kyle Dyer


Also see other free browser automation tools like ArtOfTest and WatiN. The Selenium stack can be a little complicated to set up.

like image 22
David Laing Avatar answered Sep 30 '22 21:09

David Laing