MISCELLANEOUS USEFUL TOOLS

Some tools fall under the miscellaneous category. They are not required to perform TDD but are useful when it comes to testing your application.

nCover

nCover is a code coverage testing tool. It analyzes your tests and code and reports the percentage of code covered by the tests. There are two versions of nCover. One is open source, and the other is a commercial product that contains more features.

Figure 13-7 shows the test coverage for the Wrox.BooksRead.Web project. You can see that the HTMLHelper class has 100% test coverage, whereas the other projects have 0% test coverage. In this example, the only tests created are for HTMLHelper, so this makes sense.

images

FIGURE 13-7

nCover can be downloaded at http://www.ncover.com/.

PEX

PEX, short for Program Exploration, is a project from Microsoft Research that generates unit tests from existing code. PEX is a Visual Studio add-in that with a small amount of configuration generates a suite of parameterized unit tests that give your code a large amount of code coverage. Not only does PEX generate the tests, but it also provides suggestions on how to resolve tests that fail. PEX is great for running on legacy code or finding edge or corner cases that have been handled incorrectly. PEX is not a silver bullet and should be used with caution. Not only is TDD about testing; it's also about design. On the other hand, PEX ...

Get Professional Test-Driven Development with C#: Developing Real World Applications with TDD now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.