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 9. Testing Code > Unit Testing Basics

Unit Testing Basics

Unit testing in Visual Studio is about creating tests that test the code inside the working layers of your application. This includes the many classes that make up your business and data domain. The user interface, on the other hand, is typically tested using alternate methods of automated testing. These methods are targeted more at testers. These features and products are included in the Premium edition of Visual Studio and thus not covered here. Our focus is the code you write to test the code you write. Of course this assumes you follow good, layered architecture techniques when writing your applications. In this section we cover the basics of writing unit tests. We drill in on these basics in coming sections.

Creating a Test Project

Your developer test must exist inside a test project. This is a project that has the right references to the unit testing framework and the configuration required to be run via the test tool built inside of Visual Studio. There are two primary ways you can initiate the creation of a unit test project. You can create a test project from within the IDE, or you can automatically generate unit tests into a new test project for existing code. We start with the first option.


  

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