Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 2. Software Testing > REAL-LIFE EXAMPLE

2.5. REAL-LIFE EXAMPLE

We are going to write unit tests for a controller of a fictitious MVC framework and demonstrate how decoupling of code and reducing dependencies increase the testability. Some refactorings will almost magically make the code much easier to test.

We want to test a method of an MVC controller that is responsible for the first step to resetting a user's password. An e-mail containing a URL to visit is sent to the user. The URL contains a random code. In the second step, which we don't show, a new password is generated and transmitted after the given URL has been visited.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial