TEST RUNNERS

Having a test runner that you are comfortable with is crucial to following test-driven development practices. Many testing frameworks such as NUnit (used in the majority of examples in the previous chapters) ship with a GUI for running tests. You have learned that unit tests need to run fast, but having feedback about your tests and a way to run them that you are comfortable with ensures that you will run your tests. Often, alternatives to these GUIs that ship with unit-testing frameworks can make your life easier.

TestDriven.NET

TestDriven.Net is a popular test runner that supports running tests created in frameworks such as NUnit, MbUnit, and MSTest. TestDriven.Net personal edition is free to students and open source developers. Corporate developers must pay a modest fee, but it's worth not having to keep open the GUI interface to these testing frameworks.

TestDriven.Net integrates into Visual Studio. You can run a test by right-clicking it and selecting Run Test, as shown in Figure 13-1.

images

FIGURE 13-1

It's highly recommended that you create a keyboard shortcut so that you do not need to right-click each time you want to run your tests. To set up keyboard shortcuts in Visual Studio, select Options images Keyboard Settings, as shown in Figure 13-2.

FIGURE 13-2

Many test runners ...

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.