browserUnit

Overview


browserUnit is yet another tool to test web applications. I tried different tools for testing web applications, but none of them really satisfied my needs.

browserUnit is currently still in alpha state. You can access the project page on Sourceforge or access the subversion repository. Documentation, snapshots and binary version will follow.

Any feedback is very welcome. You can reach me (Achim) at domma@users.sourceforge.net.

Examples


browserUnit is in early alpha state, so there is not much documentation yet. To get you up and running I'll show some examples. Let us open a browser and navigate to a web page:

        Browser browser = new Browser();
        browser.navigate("http://www.google.de");
        

If you use browserUnit together with NUnit it's more convenient to derive your test classes from Browser. In the following examples I will only show the body of the test methode. Tests become quite simple an readable this way.

        [TestFixture]
        class MyTestFixture : Browser
        {
            [Test]
            public void googleTest()
            {
                navigate("http://www.google.de");
            }
        }
        

As mentioned in the overview, browserUnit is heavily inspired by Watir. C# does not supports named parameters like Ruby. To mimic the syntax as close as possible, I decide to use the following schema: button, links, ... are funktions which return the matching html elements from the current page. They expect an optional list of filters to specify which tags you want. Let's fill the text box:

        textfield(              //  method to get textfields
            name("q")           //  the filter to apply
        ).text = "browserUnit"; //  the search text
        

To get the confirmation that browserUnit is not very known yet, let's click the search button:

        button(             //  method to get buttons
            name("btnG")    //  the filter to apply
        ).click();          //  click the button
        

Following Release Early, Release Often I decided to release an early alpha version. In the future I'll implement the remaining html controls (radio buttons are 'working' already) and provide more documentation.

Any feedback, contributions, remarks, ... are very welcome! You can reach me at domma@users.sourceforge.net.