AI In Automation Testing

AI based algorithms and toolsets can be used to make the software testing activities. with more and more research happening in AI area, we will see that many use cases achieved which were earlier unthinkable. In this article, let us look into some of the scenarios that can be integrated into Selenium by using pattern analysis techniques of web HTML in the runtime.

  • XPath less Testing
  • Object Healing
  • Visual Testing
  • Auto Login
  • Enter Text fields
  • Search on website

XPath less Testing

XPath less testing is a way of building test scripts by creating objects using how you see them on the screen rather than the traditional HTML or CSS based object identification. The biggest aim of this approach is to enable a non-technical person to successfully build web object definitions and if the framework is scripless, a test case can be created just by drag and drop of automation components (business objects naming)

How It Works

Consider a test case in which we need to click on Sign In link and then enter username and password and click on Login button and choose and add a dog puppy to cart and checkout.

Traditionally we will first use an object Spy or inbuilt web inspector to capture XPath or CSS of each object involved in a given page and create multiple page objects and finally integrate them with object manipulation actions in the framework to achieve the functionality.

In the new AI based pattern matching approach, object is identified using visible identifiers. For example, In the above page sign In link is identified just by using string sign in or just signin.

The supplied string is first processed to remove unnecessary spaces and junk characters. Then the given pattern string is matched with screen objects for known attributes

id, name, text, value, aria-label, title, header, alt, placeholder, class etc. and the best fit object is found which matches the pattern. Also, the supplied action is considered in object search.

For example, in the below scenario if the object identifier is sent as Username and action is sent as Enter j2ee, even though the object search will match the label Username: due to the action supplied, nearest input field will be chosen.

Object Healing

Object Healing is a process using which we can fix the web object locators in the run time if anything changes due to website development changes.

Object will be searched on the web page using the string which it is associated on the screen

Object will be identified and generated with all attributes like Xpath, text etc.

During website development process, if object Xpath changes due to layout change or other things, the object in usual cases will be invalid. During test case execution, during first iteration the action fails as the object is invalid. But if object is not identified, then it will be tried to re establish the object using the identifier initially used to create the object. If that is similar to the old value, then object will be successfully found again.

Visual Testing

Visual testing is a process in which the layout changes of the webpage is found with reference to the base image. This testing is a kind of image comparison which is a sanity testing when a webpage is migrated to a new instance

Auto Login

login is usually a function which involves 3 steps:

  • Enter User name
  • Enter password
  • Click on login pr submit button

With AI based pattern matching techniques, we can automate the process without having to know the involved web objects in advance.

Enter Text Fields

This function fiends out all the input fields on a web page and identifies the type of input the fields take. Based on this information, during the runtime, automated test data provisioning is invoked and the fields are filled with the appropriate values. Example: This feature can be useful in entering details in checkout form.

Search On Webpage

e-commerce test sites usually have a search box and associated button to submit the search. These can be found using AI based pattern matching techniques and searching product on a page can be automated


Comments

Leave a Reply

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