How would You Automate This: Tags

Tags are metadata that allow us to make an association or a reference to an item within a system or an application. Tags allow a user to group related content and display that content in one place or view.

In most instances, it is possible to assign multiple tags to an item. Social media users are familiar with the hashtag used on sites such as Twitter and Facebook. Bloggers on a variety of platforms use tags to display grouped content, such as a navigation menu item that shows all of the items that match a tag or a set of tags.

Tags by their nature are coupled with Search, which was covered earlier in this series.

If your application implements tagging, the first thing to do is determine where tagging can be done. Then you should ask several questions:

  • If my application has an announcements or comments section (think Twitter or Facebook again), can I use tags in the posts I create? How about the comments?
  • If my application creates pages or other content, can I tag that content? Can I place tags inside the content, such as in a wiki page or blog post?
  • Is it possible for me to remove tags and reapply them?
  • Can I add tags that reference people?
  • Is it possible to add multiple tags to a single entity?
  • Can I do a search on a tag and find what I am looking for?

Common Automation Tricks

Having a variety of tags defined and applied to various items in the application will help determine whether we can find the values we are looking for. If an item allows multiple tags, searches need to be created that look for the tags individually and in combinations. The more tags that are used, the greater the possible number of combinations.

Exhaustive testing of all possibilities is beyond the scope of this article. Suffice it to say that the ability to test for a single tag, several tags, and all tags of an item may be sufficient. Here again is where having a data set with a predetermined number of items tagged can be of benefit.

Many applications allow tagging with a simple interface in a sidebar next to the document being displayed. In this case, simply select the text box and fill it in with text, then press the accept button to tag the item. There may be a pre-populated list with a drop-down box or checkboxes to select, but the principle is the same. Once we add the tag, we want to be able to physically determine that the tag is present and visible.

Some applications allow the users in the system to be tagged with an item. Often this is a text box and an “Add” button. In this example, there may also be an option that allows a tag to be made, but it will be listed as pending because the user the tag is applied to should have a say regarding whether that tag is appropriate and should be applied to them. Print a validation that “pending” or some other informative text is displayed for the user and will not appear in searches unless the user accepts the tag.

Because tags can be applied to a variety of items, using an API and adding or removing tags via calls to the API saves time and allows for modifying a large number of items.

The end result of adding tags is the ability to find and display items that have the tags associated with them. After applying or removing tags, make a call to your system that processes a reindexing job. Set a wait for a return value so that you know the indexing job has completed.

There may be a series of tags you want to create and then completely remove from all items in your application. Append a value of ${starttime} to any tags created for this purpose so that the tag is easier to add, identify and remove.

Things That Are Hard to Automate

Editing pages where tags can be embedded can be difficult, especially if the process requires interaction with the editor’s toolbar to perform the task. Ideally, the application will have an alternate way to edit the document and display the tag. If the option is available, you should switch to that mode and create the tag that way. If that’s not possible, you will need to walk through the steps necessary to place the tag inside the text of the document.

Permissions are important, especially when it comes to tagging people. There should be a hierarchy of permissions that can be applied, such as an administrator being able to apply tags to all users, managers being able to apply tags to their direct reports and individuals being able to apply tags to themselves. Beyond that, there should be a request process that waits for a confirmation from the user that the tag is appropriate and will be accepted.

This can add a number of steps to any end-to-end or workflow test. If an API allows me to set a tag with one user permission, it’s possible to send another API call as a different user to accept that tag. Again, running a reindex job may be required to be able to see that the value has been applied and can be viewed as pending.

Common Themes

In this series, there are going to be some familiar patterns and areas that need to be considered for effective testing. Several of these are areas that could be combined into modules, considering that they may be used frequently.

Known Data Set

Because tags can be applied to a number of different items, my known data set has to include a number of items that are already tagged. This can include pages, accounts with existing users, user profiles, conversations with comments, and documents with tags associated with them, both as metadata of the document itself and within the document. Having a count of these pages and an expected number of tags to compare against and review is valuable for running on different versions of software, especially after upgrading.


In addition to being able to create, modify or delete tags, I also need to confirm the level of permissions that will allow me to tag everyone and everything and tag items associated with an account or group, as well as to confirm I cannot create, view, modify or delete tags if I don’t have the appropriate permissions.


It’s important to see if different language options (localization) are maintained. By varying the use of diacritical marks used in Roman alphabets and creating sections that use different alphabets (Kanji, Hangeul, Cyrillic, etc.), I can confirm they are part of the known data set as well as tags I’ve added to new items.

Reindexing Frequently

Any time I add something that affects how an item can be tagged for search or display, I need to run a reindex job to confirm that the tags are visible and associated with the item. Likewise, I need to do the same if I remove tags so that I do not get false positives.

Cross-Browser Tests

Because different browsers have different ways of displaying elements such as text boxes, drop-down boxes, checkboxes and other methods of entering tags, I will have to compare and contrast these interactions with a variety of browsers.

Download your risk-free, full-featured version of Ranorex Studio now to experience the power of test automation.

Get a free 30-day trial

About the Author

Michael Larsen has, for the better part of his 20+ year career, found himself in the role of being the “Army of One” or “The Lone Tester” more times than not. He has worked for with a broad array of technologies and industries including virtual machine software, capacitance touch devices, video game development and distributed database and web applications. Michael currently works with Socialtext in Palo Alto, CA.

You might also like these articles