Chapter 8. Testing Code

Developers have always been responsible for testing their code before it is released to testers or users. In years past, this meant walking through every line of code in the debugger (including all conditions and errors). To do so, you often had to create test-harness applications that mimicked the functionality required to execute your code. Stepping through all your code in a debugger made for a fine goal but was not always realized (and was difficult to verify). In fact, the entire exercise was often skipped during code changes and updates. In addition, this process made it difficult to see if your code changes affected other parts of the system. The result was lower-quality builds sent to testers and users and thus higher defect rates and wasted time going back and forth between developers and testers.

The unit test framework in Visual Studio provides a robust, automated means for developers to test code as they write it. Tests are saved and run again if any code changes. This helps with regressions and increases confidence in last-minute fixes, refactoring, and late additions.

This chapter covers the basics of unit testing and the details of the unit test framework. With this information in hand, you are on your way to realizing the benefits of automated, developer testing, including fewer bugs, easier to understand code, and additional confidence in code changes.


Intellitest

Visual Studio 2015 introduces IntelliTest. This feature examines your code and generates a suite of unit tests and even test data on your behalf. This is especially useful for developers that work with an existing code base that does not have an associated set of unit tests. IntelliTest will explore your code and analyze every conditional branch for a possible test.

IntelliTest is part of Visual Studio Enterprise 2015 and not Professional (the focus of this book). You can learn more at: https://msdn.microsoft.com/en-us/library/dn823749.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset