UI Action Methods

These methods are only applicable for UI Based Test Class. i.e. web, mobile & desktop based pass testing

Assertion methods

In testing context, assertions make sure the product has met the expectations. QATTS gives you various useful and simple methods to run assertions.

  1. State Check

  2. Assert HTML Elements

  3. Assert Product Elements

  4. Assert Groups

State Check

stateCheck is a feature to know whether the execution control landed on the intended page. This method requires three parameters.

Syntax

void stateCheck(String htmlElementName, String attType,String targetValue)

Name

Type

Description

htmlElementName

String

Dom element name

attType

String

Type of the attribute

targetValue

String

The actual value of the html element

Code snippet

/* 
 *  "I'm Feeling Lucky" button is found on Google's home page, 
 *  which tells you that you are rightly landed on Google's 
 *  home page
 */

stateCheck("bt.iamfeelinglucky", "value", "I'm Feeling Lucky");

Assert HTML Element

assertElement method compares the actual value of a html element name with the expected target value. Here the attType param gives additional information about the html element on with the assertion has to be made.

Syntax

boolean assertElement(String htmlElementName, String attType, String targetValue)

Name

Type

Description

htmlElementName

String

HTML element name

attType

String

Type of the attribute

targetValue

String

The actual value of the html element

Code snippet

/*
 * Comparing the firstresult of Google search with "https://qatts.com/"
 */

assertElement("li.firstresult", "href","https://qatts.com/");

Assert Product Elements

assertField methods compares the actual value of the Product element with the expected value. There are two method variants in this category. The first method with additional param Object objectValue can used when you know exact expected value or the expected value is expected to be from previous test result.

The latter method will perform assertion from the test data found in the excel sheet.

Syntax

  1. boolean assertField( String prodElementName, String elementType, Object objectValue)

  2. boolean assertField( String prodElementName, String elementType)

Name

Type

Description

prodElementName

String

Dom element name

elementType

String

Type of the UI element. [input, view, error]

objectValue

Object

The actual value

Assert Groups

Group assertion is similar to the above element assertion. The only difference is you will be doing assertion on a group. All the Product element under the given group will be asserted in a single go. By setting recursive, Qatts will find all the product elements under the group by continuously looping through subgroups.

Syntax

  1. boolean assertGroup(String groupName,String elementType)

  2. boolean assertGroup(String groupName, String elementType, boolean recursive)

Name

Type

Description

groupName

String

Name of the group

elementType

String

Type of the UI element. [input, view, error]

recursive

boolean

TRUE or FALSE

Data population methods

Automation process requires loading of test data from the data repository. QATTS has couple of data loading methods that assist in test automation process. These methods work on Product Elements.

Populate Field

populateField method is used to populate the UI element with the test data.

Syntax

  1. void populateField( String elementName)

  2. void populateField( String elementName, Object objectValue)

Name

Type

Description

elementName

String

Name of the group

objectValue

Object

The value to be search

Code Snippet

/*
 *
 */
populateField("SearchText", "Apple");

Populate Group

void populateGroup( String groupName)

void populateGroup( String groupName,boolean recursive)

Populate Alert

void populateAlert(String productElement)

List extractLinks(String url, String productElement)

List extractLinks(String productElement)

Map checkBrokenLink(String url)

Other UI action Methods

Perform Named Action

void performNamedAction( String actionName)

Perform Field Level Actions

void performFieldLevelAction(String sectionName)

Perform Element Checks

void performElementChecks( String sectionName)

Perform Page Checks

void performPageChecks(String productElement)

Wait for invisibility of element

boolean waitForInvisibilityOfElement(String htmlElementName)

Get table data

List> getTableData(String UIElement)

Refresh page

void refreshPage(String url)

Alert action

void alertAction(String htmlElement, String data)

Get element size

int getElementSize(String htmlElementName)

boolean contains(String htmlElementName, String attType,String targetValue)

boolean containsElement(String htmlElementName)

boolean containsText(String findText)

Map extractGroup( String groupName,String elementType)

Map extractGroup( String groupName,String elementType,boolean recursive)

QArray extractTableData(String htmlElementName)

String getErrorMsg(String elementName)

String getText(String htmlElementName)

String getAttribute(String htmlElementName,String attName)

List getAttributesAsList(String htmlElementName)

void clearField(String elementName)

boolean mouseOver( String elementName)

boolean mouseOverAndClick( String elementName)

boolean mouseOverIf( String elementName)

boolean mouseOverAndClickIf( String elementName)

void switchWindow(Integer windowNo)

void switchWindow(String windowName)

void switchToFrame(String nameOrId)

void switchToDefaultFrame()

void closeWindow(Object window)

boolean clickIf( String elementName)

boolean click( String elementName)

void takeScreenShot(String labelName)

void checkW3(String url)

void checkW3()

void checkAccessibility()

void checkAccessibility(String url)

void checkAccessibility(String url,String uAgent)

void checkAccessibility(String url, boolean uAgent)

Object getUserInput(String ...attName)

Last updated