The 5 Popular Test Automation Actions You Need To Know

cerberus-post-5-actions-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 🙂

Leave a comment

Your email address will not be published. Required fields are marked *

Cerberus-Testing Terms Of Service


Website Terms and Conditions of Use

1. Terms

By accessing this Website, accessible from http://vgeouyk.cluster030.hosting.ovh.net, you are agreeing to be bound by these Website Terms and Conditions of Use and agree that you are responsible for the agreement with any applicable local laws. If you disagree with any of these terms, you are prohibited from accessing this site. The materials contained in this Website are protected by copyright and trade mark law. These Terms of Service has been created with the help of the Terms of Service Generator and the Privacy Policy Template.

2. Use License

Permission is granted to temporarily download one copy of the materials on Cerberus Testing's Website for personal, non-commercial transitory viewing only. This is the grant of a license, not a transfer of title, and under this license you may not:

  • modify or copy the materials;
  • use the materials for any commercial purpose or for any public display;
  • attempt to reverse engineer any software contained on Cerberus Testing's Website;
  • remove any copyright or other proprietary notations from the materials; or
  • transferring the materials to another person or "mirror" the materials on any other server.

This will let Cerberus Testing to terminate upon violations of any of these restrictions. Upon termination, your viewing right will also be terminated and you should destroy any downloaded materials in your possession whether it is printed or electronic format.

3. Disclaimer

All the materials on Cerberus Testing’s Website are provided "as is". Cerberus Testing makes no warranties, may it be expressed or implied, therefore negates all other warranties. Furthermore, Cerberus Testing does not make any representations concerning the accuracy or reliability of the use of the materials on its Website or otherwise relating to such materials or any sites linked to this Website.

4. Limitations

Cerberus Testing or its suppliers will not be hold accountable for any damages that will arise with the use or inability to use the materials on Cerberus Testing’s Website, even if Cerberus Testing or an authorize representative of this Website has been notified, orally or written, of the possibility of such damage. Some jurisdiction does not allow limitations on implied warranties or limitations of liability for incidental damages, these limitations may not apply to you.

5. Revisions and Errata

The materials appearing on Cerberus Testing’s Website may include technical, typographical, or photographic errors. Cerberus Testing will not promise that any of the materials in this Website are accurate, complete, or current. Cerberus Testing may change the materials contained on its Website at any time without notice. Cerberus Testing does not make any commitment to update the materials.

6. Links

Cerberus Testing has not reviewed all of the sites linked to its Website and is not responsible for the contents of any such linked site. The presence of any link does not imply endorsement by Cerberus Testing of the site. The use of any linked website is at the user’s own risk.

7. Site Terms of Use Modifications

Cerberus Testing may revise these Terms of Use for its Website at any time without prior notice. By using this Website, you are agreeing to be bound by the current version of these Terms and Conditions of Use.

8. Your Privacy

Please read our Privacy Policy.

9. Governing Law

Any claim related to Cerberus Testing's Website shall be governed by the laws of fr without regards to its conflict of law provisions.

Thank you for your interest in cerberus,

In order to proceed with your SaaS we need some in order to confirm your instances accesses.

Please provide accurate contacts to secure the process.

You can cancel any time the subscription, please read Terms of Use.