Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How Hard Can It Be? Unit Testing ASP.NET MVC Views

How Hard Can It Be? Unit Testing ASP.NET MVC Views

Unit testing MVC Views is not easy at first. The learning curve is steep, but not long. Once you get started and know the basics, its pretty easy to repeat the process. I’d like to share what I’ve learned about testing the V in MVC. We'll start with File->New Project and use ApprovalTests to build a small suite of tests that run consistently in Visual Studio, under NCrunch, and on the Build Server.

Jim Counts

July 18, 2012
Tweet

More Decks by Jim Counts

Other Decks in Technology

Transcript

  1. This Fox has a longing for grapes: He jumps, but

    the bunch still escapes. So he goes away sour; And, 'tis said, to this hour Declares that he's no taste for grapes. Baby's Own Aesop (1887), Walter Crane Image courtesy of Project Gutenberg
  2. How hard can it be? Testing ASP .NET MVC Views

    with ApprovalTests Jim Counts | @jamesrcounts | ihadthisideaonce.com
  3. TDD for ASP.NET MVC Views, Not Easy at First The

    ApprovalTests Library Provides a Way To Test Easy to Repeat Once You Know How
  4. Plan •File -> New Project •Setup Basic View Tests •Run

    Tests In Three Environments •Setup Tests with Data •Make a few common mistakes
  5. Resources Repo • http://bit.ly/OD92cE Videos • @LlewellynFalco: http://youtu.be/SttlPzwJw3U • @DeadlyApps:

    http://youtu.be/5gIeJ6z82Pk Posts • Getting Started: http://wp.me/p1HYUa-5o • Working with Data: http://wp.me/p1HYUa-5F • Tackling the Build Server: http://wp.me/p1HYUa-5M Slides • http://bit.ly/NAT5ZM
  6. Questions, ideas? @LlewellynFalco/#ApprovalTests • ApprovalTests creator • Loves Pairing @jamesrcounts

    • Always happy to help • Check out my blog: ihadthisideaonce.com