1.6. Where to Start

Getting the terminology down is the first hurdle. In the following chapters we will discuss the terminology and different types of testing disciplines. Where applicable, templates will be provided to help get you started. The best way to start testing is to jump in headfirst. Pick a project you're familiar with and create some tests.

Generally, most companies use a common library or framework for various projects. These frameworks take the form of logging, data access, message handling, and so on. A good way to learn how to write good unit tests is to start unit testing this library. You may see that the library you thought had a good architecture is not as easy to test as you expected. Nowadays, most of these frameworks also include their own unit tests that you can use as reference material. Another great way to start is by looking at other peoples' tests with open source projects being a goldmine of useful information. By seeing how other people created tests for these projects, you will be able to pick up some tricks to help you when you start writing tests.

1.6.1. Getting Started with Test Driven Development

Before you dive into TDD, you should spend a great deal of time working with code that was not designed to be tested via automation. Focus on techniques and patterns to write good tests for the code you are able to test. Slowly start to refactor code that is not testable into new abstractions that are testable. Spend time learning how to break dependencies. ...

Get Testing ASP.NET Web Applications 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.