The 5 Popular Test Automation Actions You Need To Know

Our colleagues of TestProject analyzed the most used actions in their library of +1,500+ automation actions.

We thought it could be useful to share how you can implement those actions leveraging the open-source framework Cerberus Testing,

In this article, we will share the key concepts for each action and link to the actionable documentation you could need.

Here are the 5 actions to go through :

  1. Click if visible (51K)
  2. Click using JavaScript (42K)
  3. API testing with HTTP Get request (20K)
  4. Get CSS value (13K)
  5. Visual Testing to Compare Image with UI element (10K)

Action #1: Click if visible

In the era of web and mobile interfaces, clicking only on visual elements emerges as the number one action in test automation.

It raises the constraint for automation to be as close to human behavior as possible.

In our case, that means to click on an element only it is visible.

The implementation of the “Click if visible” can be done in two ways inside Cerberus Testing :

  1. Use the action “click”, that behind the scene had a timeout you can tune
  2. Combine the action “wait” targeted to an element, before performing the “click” action

It is in fact up to you to choose, depending on the trade-offs.

The first option being more indirect and hidden in your test, removing the timeout configuration from your test.

The timeout parameter is the following “cerberus_selenium_action_click_timeout”.

The second one is more explicit and can be configured per test, bringing more flexibility at the cost of configuration.

Here is for reference the action library documentation.

Action #2: Click using JavaScript 

Why would we need to click using Javascript anyway?

TestProject explains the motivation on this action documentation page.

Inside Cerberus you can use the standard action “executeJS” that can execute the javascript.

document.getElementById("myElement").click();

You even have the flexibility to perform various javascript operations.

var newOption = new Option('%property.ApplicationName%', '%property.ApplicationName%', true, true);

$('#application').append(newOption).trigger('change');

Action #3: API testing with HTTP Get request

We now move to the API testing use-cases, in particular with the REST use-cases.

Cerberus Testing supports various APIs formats that rely on the HTTP protocol: SOAP, REST, GraphQL, Kafka.

We will focus on the REST API use-cases as this is the most used one.

The three main elements to use in Cerberus are :

  • Application: The configuration of the typology and environments
  • Service: The definition of the different GET and POST APIs calls
  • Test Case: The actions and controls to execute

This separation of concerns allows you to decouple each part and expand them independently.

You can for example add a new country and its 5 testing environments, without touching your service or test case definition.

Then inside your Test Case, the “callService” action explicit the call to your API. 

Your test case can be then complemented by any combination of actions and controls you desire, to enrich your API test or even combine it with web or mobile action inside the same test.

You can access the tutorial in video or in this article.

Action #4: Get CSS value

Surprisingly this action is in the top 4, not seeing, at first sight, the major type of verification to perform.

Cerberus Testing supports this case using the “Property” inside a Test Case, available in the second tab of your Test Case definition.

We recommend you to use the following actions by this order of priority :

  • getFromHtmlVisible” to retrieve only visible css elements
  • getFromHtml” to retrieve any css element, being visible or not
  • getFromJS” to implement the function using Javascript

Using the native HTML Cerberus action, you just have to specify the element path up to your css element.

With Javascript, you can use one of those 2 functions Element.querySelector() or Element.querySelectorAll().

From our perspective, the use of specific Javascript functions should be limited for the maintenance of your tests.

If you feel something is missing, feel free to share via a GitHub issue or slack, we can directly enrich the framework 🙂

Action #5: Visual Testing to Compare Image with UI element

Comparison testing is a regular use-case of user interfaces.

We usually want to ensure the stability of a particular page display or verify the presence of particular sub-elements in a page.

Cerberus Testing uses Optical Character Recognition (OCR) to support this use case.

The configuration is done at the control level :

  • Define a control of type “verifyElementPresent
  • Define the starting path as “picture=%object..pictureurl%
  • Click on the right “+” sign appearing to upload the screenshot of your expected image

You can see it in action in this video Image Comparison in Selenium with Cerberus Testing.

Expand Your Test Automation with the Open Source Framework

That’s it we covered the 5 main actions implementation using Cerberus Testing.

You can explore the action and control library readily available inside Cerberus to see the various possibilities.

The power of the framework is to scale your test automation, building your test library, setting up test campaigns, scheduling them, receiving alerts and leveraging the reporting capabilities.

You can freely access Cerberus Testing, join the community on Github, the community slack, and star it if you like it 🙂

The 5 Popular Test Automation Actions You Need To Know
Scroll to top