Unit Testing and the importance of naming
October 13th, 2007
Microsoft’s VSTS lacks RowTest and that’s why I will not use it.
But there is one thing about VSTS that is done right.
It is naming.
We use TestFixture so often, but what is it exactly?
Let’s go to wikipedia:
Test fixture refers to the fixed state used as a baseline for running tests in software testing.
The purpose of a test fixture is to ensure that there is a well known and fixed environment in which tests are run so that results are repeatable.
If I go and ask all developers I know, no one would be able to repeat this definition.
And it is why unit testing was really hard for me to understand.
TestClass and TestMethod are practical names that desribe what we want to do.
TestFixture is an academic name that describes what we are supposed to do.
It conveys the feeling that I should read a tome of obscure knowledge to get it.
While I am fine with reading, this time things just seem to be hard.
Take VB’s Shared versus C# static.
How many people you know understand why static keyword has this name?
But we still have to live without useful features just because of the name.
The moral of the story: naming is very important.
It can make things unnecesarily complex or decrease your agility in changing underlying behavior.