Many agile teams seem to prefer UI level automation or think that such level of testing is necessary to prove the required business functionality.
However, within six to nine months after starting this effort, they will soon realise that the cost of maintaining UI level tests is higher than the benefit they bring. Many have thrown away the tests at that point and effectively lost all the effort they put into them. UI level test automation should be avoided or at least kept to the bare minimum, but if you have to do UI test automation, here is how do go about doing it so that the cost of maintenance doesn’t kill you later.
Three Levels of UI Test Automation
A very good idea when designing UI level functional tests is to think about describing the test and the automation at these three levels:
- Business rule/functionality level: what is this test demonstrating or exercising. For example, free delivery is offered to customers who order two or more books.
- User interface workflow level: what does a user have to do to exercise the functionality through the UI, on a higher activity level. For example, put two books in a shopping cart, enter address details, verify that delivery options include free delivery.
- Technical activity level: what are the technical steps required to exercise the functionality. For example, open the shop homepage, log in with “test_user” and “test_password”, go to the “/book” page, click on the first image with the “book” CSS class, wait for the relative page to load, click on the “Buy now” link… and so on.