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
  • PrintPrint
Share this Page URL
Help

3. How to Write a Unit Test

3. How to Write a Unit Test

You’ve now seen what we’re trying to achieve by testing software, and how test-driven software and unit tests can help to achieve that. But how exactly is a unit test written? In this chapter you’ll see a single unit test being built from first principles. You’ll see what the different components of a test are, and how to go from a test or collection of tests to production code. The code in this chapter is not part of a project: It just shows the thought process in going from requirement to tested app code. You do not need to run the code in this chapter.


  

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


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint