TDD with Monorail – Part 2

System Requirements

So where do we begin? Well lets try to quantify what it is that will be expected of this forum system once complete. So from a very high level I would like my forum to:

  1. Have the concept of Categories
  2. Have the concept of Subjects
  3. Have the concept of Threads
  4. For registered Users to be able to create new threads
  5. For registered Users to be able to reply to existing threads
  6. For unregistered Users to be able to register
  7. For administrators to be able to manage Categories
  8. For administrators to be able to manage Subjects
  9. For administrators to be able to manage Users

I know that these requirements may seem obvious but I like to have some boundaries to work within and these points should give me something to build on when I am fleshing out my specifications in code.

So as you can gather by now I am going to be using my text fixtures as specifications as I am going to work test first. I would like to be able to match my spec names in my code to the requirements/acceptance criteria. My current thinking is that these direct matches will only occur in the integration tests, this is a bit experimental for me, as I have not does this before so we will have to see how this works out in practice.

The project setup

Solution Explorer

Solution Explorer

The solution itself has been configured using a build from the Castle trunk which was run a few weeks ago. I have 3 projects which have been configured in the usual way with Windsor and NUnit, nothing too exciting there. The core project will contain the domain model, repositories, messages and mappers etc, the specs project contains all of my integration and unit tests. A couple of points on my specs project, the app.config sets up the thread state to allow the WatiN tests to run inside NUnit. Here is the app.config for reference.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <sectionGroup name="NUnit">
      <section name="TestRunner" type="System.Configuration.NameValueSectionHandler"/>
    </sectionGroup>
  </configSections>
  <NUnit>
    <TestRunner>
      <!-- Valid values are STA,MTA. Others ignored. -->
      <add key="ApartmentState" value="STA" />
    </TestRunner>
  </NUnit>
</configuration>

I have categorised my tests so that I can just run the unit tests quickly during development. This is achieved by decorating the test fixture class with a category attribute. For example:

[TestFixture, Category("Integration")]
public class testFixtureName
{

}

I am going to try and keep the code as clean as possible and to enable effective testing.

Oh, by the way the project is named GrassRoots because the forum is intended for a local sports club that I am a member of. (If I finish it!)

One more thing! – I am using ‘code snippet plugin for windows live writer’ in windows live writer to create these code snippets, does anyone know of a good plugin? I am not sure that I am happy with how these boxes look on my blog.

Advertisements

~ by Tim on 17 July 2008.

Leave a Reply

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

WordPress.com Logo

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

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s

 
%d bloggers like this: