Search code examples
asp.net-mvcasp.net-mvc-3coded-ui-testswatin

WatiN best practices/rules of thumb for an ASP.NET MVC app


I'm an avid TDD and BDD fan but haven't done much in the ways of UI testing. I have an ASP.NET MVC 3 application with many MSpec tests and I'd like to add presentation tests using WatiN.

What sort of stuff do you test? Do I have to write tests for the initial load of the UI or only for things that changed due to user interaction?

What are, in short, good rules of thumb and best practices when writing WatiN (and UI tests in general) tests?


Solution

  • Where I work now, we test these 5 things (where applicable) for each page:

    1. Layout - should have textbox labeled X, should have dropdown labeled X
    2. Populate - should have dropdown with the following values ... should have textbox with the value
    3. Validate - when I enter X, then I should see the error message Y
    4. Navigate - when I click X button, then I should go to Y page
    5. Save - when I click save button, then I should see the Success message