Developer Blog Banter #2 response

This is my response to the 2nd Developer Blog Banter. The question asked is

How do you organise your tests. Do you separate your unit tests, integration tests and UI tests into separate projects? Do you do anything specific to keep track of your tests? What naming conventions do you use? Do you run them before a check in or is that what the build server is for?


Most of my testing efforts focus on unit testing. I structure it so that I have a unit test project per code project. For example


If it is a really small application with only a logic project and a host, then I will usually roll the tests into a single unit test project.

Naming conventions old

My naming conventions of my unit tests have change from project to project. On my last project I used to put all unit tests for a class into a single test class and do name each test something similar to this TheBusinessLogicCreatePersonMethodShouldReturnANewPerson()

However I found the names too long to quickly see what broke. Having them all the tests in a single TestClass combined with the tests being sorted alphabetically in the test results it would make it really hard to see what area of my code had broken.

Naming conventions new

I was talking to Damian Maclennen who showed me an example of how he is setting up his BDD tests. I took his approach of using extension methods and bastardised it into my new naming convention.

In my unit test project, I have a namespace for each logic class I am testing. E.g. Person

Inside of that namespace I have a TestClass for each method I am testing on that class. I name the test class with the method name and ‘Should’ appened to the end, e.g.

Finally I have all of my tests for that method inside that class. This brings it out so my tests look like

namespace DavidProject.BusinessLogicTests.Person
    public class CreatePersonShould
        public void NotCrashWhenPassedNull()

When I run my tests in Resharper, I will then see all of the tests nested nicely by class name, and then all of the tests for that method.

When do I run them?

Whenever I change a big chunk of code. I don’t practice TDD, I usually create tests and code together as I write (or slightly after I have finished writing the code).

I haven’t set it up to run them on the build server on my current project, that is something I’ll get running this week.

Other forms of testing

I don’t do automated UI tests as I feel the effort required to script them isn’t worth the pay off as they are very brittle.

By David Burela

2 thoughts on “Developer Blog Banter #2 response

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s