Click here to Skip to main content
15,897,334 members
Articles / Web Development / XHTML

A Test Harness with WatiN, TestDriven.NET, NUnit with Visual Studio 2008 (Team System)

Rate me:
Please Sign up or sign in to vote.
4.30/5 (16 votes)
15 Sep 2008CPOL4 min read 49.1K   492   27  
UI and Functional Testing through different Tools using .NET Technology
using System;
using NUnit.Framework;
using WatiN.Core;
using System.Text.RegularExpressions;

namespace Tests
{
    [TestFixture]
    public class MainTest : MainProgram
    {
        [Test]
        public void CheckBadLogin()
        {
            ie.GoTo("http://localhost:2434/");
            ie.TextField(Find.ById("TextBox1")).TypeText("rabbi");
            ie.TextField(Find.ById("TextBox2")).TypeText("rabbi");
            ie.Button(Find.ById("Button1")).Click();
            Assert.IsFalse(ie.ContainsText("Unknown User"));
        }

        [Test]
        public void CheckLogin()
        {
            ie.GoTo("http://localhost:2434/");
            ie.TextField(Find.ById("TextBox1")).TypeText("rabbi");
            ie.TextField(Find.ById("TextBox2")).TypeText("rabbi");
            ie.Button(Find.ById("Button1")).Click();
            Assert.IsTrue(ie.ContainsText("Welcome Rabbi"));
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Team Leader SoftwarePeople| Enfatico
Bangladesh Bangladesh
I work for SoftwarePeople. See my linkedin profile here

Comments and Discussions