KEMBAR78
Unit Testing Asp.net and Asp.net MVC | PPTX
Unit Testing
 ASP.Net and
 ASP.Net MVC


Gil Zilberfeld

23-Nov-2011
Agenda
•   What is different from testing regular apps
•   The performance hit of testing with a browser
•   What’s new in MVC that makes it more testable
•   What still remains in MVC that’s still hard to test
•   What needs to be tested – logic
•   Example – testing what’s written to the client
•   Example – testing an MVC controller
•   Example – testing for security logging
•   Example – testing control logic with Ivonna
•   Call to action – download Isolator.Net and Ivonna
ASP.Net apps hard to test
• Rely on server state
  • HttpContext and friends
• Testing through browser is:
  • Slow to run
  • Hard to debug
• ASP.Net is not test-friendly
  • HttpContext and friends
And MVC?
• More test-friendly
  • Works through interfaces
  • BaseHttpContext
• But not completely
  • For example: Redirection
  • And your code
Examples
• ASP.Net
Questions?

www.typemock.com    www.gilzilberfeld.com

blog.typemock.com     gilz@typemock.com

@typemock                  @gil_zilberfeld

Unit Testing Asp.net and Asp.net MVC

  • 1.
    Unit Testing ASP.Netand ASP.Net MVC Gil Zilberfeld 23-Nov-2011
  • 2.
    Agenda • What is different from testing regular apps • The performance hit of testing with a browser • What’s new in MVC that makes it more testable • What still remains in MVC that’s still hard to test • What needs to be tested – logic • Example – testing what’s written to the client • Example – testing an MVC controller • Example – testing for security logging • Example – testing control logic with Ivonna • Call to action – download Isolator.Net and Ivonna
  • 3.
    ASP.Net apps hardto test • Rely on server state • HttpContext and friends • Testing through browser is: • Slow to run • Hard to debug • ASP.Net is not test-friendly • HttpContext and friends
  • 4.
    And MVC? • Moretest-friendly • Works through interfaces • BaseHttpContext • But not completely • For example: Redirection • And your code
  • 5.
  • 6.
    Questions? www.typemock.com www.gilzilberfeld.com blog.typemock.com gilz@typemock.com @typemock @gil_zilberfeld