Art Of Unit Testing - Book Wiki > Chapters > 2. The First Unit Test

2. The First Unit Test

Starting Paragraph

When I first started writing unit tests with a real unit test framework, there was little documentation out there for me to learn how to use them. The frameworks I worked with (I was mostly coding in VB 5 and 6 at the time) did not have proper examples. It was a tough challenge to learn to work with them and I started out doing a rather poor job of writing tests. 

This chapter should be useful to you if you were in the same situation: You want to start writing tests, but you have no idea where to start. 

While in the previous chapter I discussed the main ideas in unit testing, this chapter should get you well on your way to write real world unit tests with a framework called NUnit- a .NET Unit testing framework. It is my favorite framework in .NET for unit testing because it’s easy to use and easy to remember, and has lots of great features.  

  

There are other frameworks out there in .NET, some with even more features, but NUnit is where I always start, and perhaps expand to a different framework when the need arises. We’ll see exactly how NUnit works, its syntax, and how to run it and get the feedback when the test fails or passes. To accomplish this, I’ll introduce a small software project that we’ll use throughout the book to demonstrate the techniques and best practices outlined in each chapter. 

First, let’s understand what a unit test framework is, and what it enables us to do that we couldn’t and wouldn’t do before using it. 

Comments? Errata?

  

  

Tag page
You must login to post a comment.