views:

164

answers:

1

I am just beginning WatiN and in a lot of blogs I see attributes like [TestMethod] or simply [Test] used.

For Example:

MSForge Blog Post

etc. etc.

but when I attempt:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WatiN.Core;
using WatiN.Core.UnitTests;
using WatiN.Core.Constraints;
using System.Diagnostics;

namespace Lemmings
{
    class Login
    {
        [TestMethod]
           ...
           ...
     }
}

[TestMethod]/[Test] is not recognized. I haven't seen anyone state that it is a custom attribute (it would also be strange if everyone was using the same custom attribute that was named the same thing) so I don't think that is likely.

What am I missing?

Note: For simple scripts [STAThread] works but if I want to use something like "ie.goto" VS2008 complains.

Any help is appreciated. Thank you.

+1  A: 

Mel,

The Test and testmethod are custom attributes that are used by unit testing tools so they know that the method is a test. The Test attribute is used by nUnit and test method is used by the Visual Studio testing tools.

For more information you should look into the getting started documenation on www.nunit.org, and download the nunit test runner.

Oh you will also need a reference to nunit and a reference to the NUnit.Framework assemmbly. If you are using visual studio 2008 professional you can just create a new test project and add a unit test.

Bruce McLeod