R – How to be successful in web user interface testing

automated-testsseleniumtestinguser interface

We are setting up a Selenium test campaign on a big web application.
The first thing we've done was to build a framework which initialize SQL data in database before the test, launch the test, archive results and then clear data.

We've integrate that in a Maven 2 process, run every day by TeamCity on a dedicated database.

We've set up several Selenium tests now but It's not as used as planned.

Reasons are that tests are sometimes broken for other reasons than regressions (data may have changed, stored procedure may have been recompiled and so on).

I would like to know if there are big success in user interface testing and if so, reasons to that. Commons errors may also interest me.

Best Answer

Testability helps a lot. The biggest win for testability in web apps is if all of the HTML elements you need to interact with on the page have unique and consistent attributes. If the attributes you are using to identify the HTML elements (Selenium uses xpath) are not consistent/reliable from build-to-build, or session-to-session, your test scripts will fail. Also, these attributes must be unique, so that the automation tool (in this case Selenium) can reliably find the object on the web page.