A Unit test should test only one thing

My blog has moved. You can view this post at the following address: http://www.osherove.com/blog/2005/4/3/a-unit-test-should-test-only-one-thing.html
Published Sunday, April 03, 2005 12:51 PM by RoyOsherove

Comments

Sunday, April 03, 2005 8:04 AM by TrackBack

# A Unit test should test only one thing

A Unit test should test only one thing - if you're doing TDD....
Sunday, April 03, 2005 12:50 PM by Mike Harges

# re: A Unit test should test only one thing

This case is a perfect place to employ MbUnit's RowTest feature:

[RowTest()]
[Row(1001, 2, 3)]
[Row(1, 1002, 3)]
[Row(1, 2, 1003)]
void Sum_NumberBiggerThan1000IsNotSummed(int x, int y, int z)
{
int sumResult = Sum(x, y, z);
Assert.AreEqual(o, sumResult);

}

In a test framework that doesn't have a similar capability, I'd probably resort to three separate tests.
Monday, April 04, 2005 11:04 PM by TrackBack

# New Team System Stuff - 2005-04-05

Visual Studio Team System

Today, we have a double-header of Team System webcasts:

9:00 AM PDT –...