Twelve Rules for Writing Unit Tests

The last three posts have discussed unit testing and even given some examples. This post lists a number of rules that you should follow when writing unit tests. Like all rules and unlike laws, they can be violated under certain conditions. But if you do not attempt to follow the rules, you will not learn when it is acceptable to violate them. Without further ado, here are my 12 rules:

Read more ›

Tagged with: ,
Posted in Testing

Comparing .Net Unit Test Frameworks

The first available unit testing framework was SUnit, written for Smalltalk. JUnit came next as a unit testing framework for Java. This led to unit testing frameworks for many other programming languages, based on the design of JUnit, and collectively known as xUnit. There are currently three xUnit unit testing frameworks for .Net: MS Test, NUnit, and xUnit.Net. With any of these, you can write tests in and for any of the .Net languages.


Let’s first look at some of the useful functionality for writing and running tests, and then at some integration and other requirements.

Read more ›

Tagged with: , , ,
Posted in .Net, Testing

Writing Unit Tests

The post, Unit Testing, covered a number of aspects of unit testing. Hopefully that post has convinced you that unit testing is a good thing and  that you should be doing it. If you are not convinced, then you will not be interested in this post.

In this post, we will look at how to write unit tests. We will start with how you might have written unit tests before about the year 2000. I touched on this in the post Testing, 1, 2, 3. Following that, we will look at unit testing frameworks. Writing some tests using some of the most popular frameworks for .Net will be left for a later post. Read more ›

Tagged with: , ,
Posted in Testing

Unit Testing

Testing shows the presence of bugs not the absence of bugs – Anonymous

What are Unit Tests?

Unit tests validate that individual components in a system function as designed. This leads to the question “What is a unit?” In object-oriented programming, a unit is typically a class. In functional programming, a unit would be a function.

The Three Steps of a Unit Test

Let’s look at the anatomy of a unit test. There are three steps in every unit test:

  • Arrange.
  • Act.
  • Assert.

In the Arrange step, the object under test is set up. This involves Read more ›

Tagged with: , ,
Posted in Testing

.Net IDE’s

Integrated Development Environments (IDE’s) have been a boon to software development. They provide the following functionality:

  • Code editing.
  • GUI builders (available GUI’s vary from one IDE to another and one OS to another. Even more may be added as libraries or extensions.
  • Builds.
  • Running of any generated executables.
  • Debugging.
  • Unit testing.
  • Source control (usually via git and GitHub, though others are also available).
  • Extensions and add-ons to extend functionality..

There are five IDE’s for .Net programming that I know of: Visual Studio, Visual Studio Code, SharpDevelop, and Project Rider. And, they are available on different operating systems, and for developing for different systems. Let’s have a look at each of these in turn.

Read more ›

Tagged with: , , , , , , ,
Posted in Development, IDE's, .Net

Testing, 1, 2, 3

In this post, I will be taking a trip down memory lane; that is, my memory, not necessarily yours. I will be blogging about methods, types and levels of testing and looking at how my coworkers and I did testing in the 1970’s through 1990’s. First, I need to provide background on the application field, and then on testing in general before I tackle the testing that we performed.

Read more ›

Tagged with: , , ,
Posted in Testing

Taking Out The Garbage

Garbage collectors are a solution to a very common problem that programmers run across in languages like C and C++: creating objects on the heap. Well, actually, the problem is not in the creation of the objects, but rather keeping track of and ownership of the objects on the heap. Specifically, when should you delete an object?

Read more ›

Tagged with: , ,
Posted in Languages