in Tech

Automated Testing at Tagged

During my four-month term as an intern at Tagged, I was responsible for writing a completely new automated testing framework for the Tagged site using Selenium and Java.

Selenium is one of the best open-source libraries for web testing today. It has bindings for several common programming languages, such as Java, as well as offering support for many browsers on different platforms including: Chrome, Android, IE, Firefox, iPhone, and Safari drivers. In this case, the RemoteWebDriver class was used exclusively so that the test suite is able to run on a VM running Selenium Server.

For the framework itself, the page object design methodology was the center of how program logic was organized and laid out in the framework. For the page object design methodology, each distinct page is represented in the framework as a “page object” with its own class. The services on the page (such as uploading a photo, adding friends and page navigation through links) are represented as methods within the page object class, and the return type of a method can be an instance of the page object that would result from the action being performed.

For example, a login method might return a new HomePage page object and a goToPhotosPage method might return a new PhotosPage page object. However this is not required, as methods can have other return types, and it’s advised to do so (a boolean return type for methods make assertions much easier). The page object design methodology can easily and accurately represent page navigation through code, then lines of code such as the following can be written:

Selenium offers support for selecting elements through XPath, CSS selectors, and id. Using CSS selectors has an advantage because it can also indirectly verify that the CSS of the site remains unchanged. The library also supports execution of JavaScript through a JavaScriptExecutor class, as well as modal dialog handling, including those “are you sure” modal dialogs. Overall, Selenium is a good library for Tagged’s testing needs.

After four months, with the help of my colleagues, the framework now contains both logic and tests that cover many of the site’s major functionalities. I now realize that developing and maintaining the framework is a never-ending effort, however, with Web technologies becoming more sophisticated and interactive, choosing a library for your needs is essential in developing a robust, clean and easy-to-read and write testing framework.


Davis Wang was a software engineering intern this winter as part of the QA team.