Automation of Admin Web UIs

By Gerald Mücke | November 23, 2015

Automation of Admin Web UIs

Particularly in the operation of legacy web applications, there are often recurring administrative tasks. It is not uncommon for such applications to have an administrative interface, but no service interface usable for administration. However, administrative tasks can be automated with simple means, provided the web interface is well-structured from an HTML and HTTP perspective. Additionally, it is advantageous if the client-server interaction does not rely too heavily on server-side session states and provides different entry points for different operations.

A good example is Struts-based applications, which represent a counterpart to REST resources with Struts Actions. Less optimal are JSF or GWT-based applications, which rely heavily on server sessions or where communication is less clear and occurs through additional layers.

If a well-structured web interface is available and the entry points are clear, a number of frameworks are available for automation:

Selenium

This framework, originally developed for automating UI tests, offers a recorder that can record and replay actions. The recorded macros can be saved and modified in Java code. Selenium offers, besides a headless mode suitable for execution via the command line, also direct support for various browsers. These different WebDriver have the advantage of being able to interpret JavaScript, but sometimes differ in their interpretation of the Document Object Model (DOM). Selenium is comparatively heavyweight for administering applications, but can handle complex and JavaScript-heavy interfaces due to its browser support.

HtmlUnit

HtmlUnit is a framework for writing unit tests against HTML interfaces. Unlike Selenium, it does not offer browser support, and the execution of JavaScript is limited for pages optimized for certain browsers. HtmlUnit provides an API for calling and navigating HTML pages.

Jsoup

Jsoup is a relatively new library for calling and parsing HTML pages. The API is very simple, allowing one to read elements of a web page with just a few lines of code. However, Jsoup does not support JavaScript.

Summary

Depending on the complexity of the page and the entry points for actions, a different library may be used. If possible, the choice should always be the lighter framework, as this reduces complexity and thus development and maintenance effort.

comments powered by Disqus