Testing Web Applications

Modern web applications separate user experience markup from the code that responds to requests and serves views to the user. This separation makes web code much more testable (as opposed to code files mixed with markup and server-side code). As an example, the ASP.NET Model-View-Controller (MVC) and web application programming interface (API) models use controllers as C# classes to respond to Hypertext Transfer Protocol (HTTP) requests and return results. This structure makes writing unit tests against controller classes a straightforward process.

There are times, however, when you need to write tests against actual pages running on the web server. Visual Studio supports this scenario, too, allowing you to write tests that have access to the server state, such as Page and Session. This section takes a look at both scenarios. For more information on writing web applications, see Part V of this book, “Building Web Applications.”

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset