Skip to content
Rust Groovy HTML TypeScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.settings first commit Jan 9, 2019
Include/config first commit Jan 9, 2019
Keywords/com/kazurayam/ksbackyard add TC2 to test case with FailureHandling as argument Jan 20, 2019
Libs implemented com.kazurayam.ksbackyard.HighlightElement#pandemic method Jan 10, 2019
Object Repository HighlightElement#pandemic() nows supports cases with FailureHandling … Jan 17, 2019
Profiles first commit Jan 9, 2019
Scripts add TC2 to test case with FailureHandling as argument Jan 20, 2019
Test Cases add TC2 to test case with FailureHandling as argument Jan 20, 2019
Test Suites README.md Jan 10, 2019
docs
settings/internal README.md Jan 10, 2019
.classpath improved the implementation of pandemic() method Jan 20, 2019
.gitignore implemented com.kazurayam.ksbackyard.HighlightElement#pandemic method Jan 10, 2019
.gitignore~ first commit Jan 9, 2019
.markdown-preview.html updates Jan 10, 2019
.project updates Jan 10, 2019
HighlightingElementByTestObjectInEachAndEveryStep.prj first commit Jan 9, 2019
README.md improved README Jan 17, 2019
console.properties first commit Jan 9, 2019

README.md

Highlighting Element by TestObject in each and every step

What is this?

This is a Katalon Studio project for demonstration purpose. You can download the ZIP from Releases page, unzip it and open with your Katalon Studio.

This project was developed with Katalon Studio version 5.10.1

This project proposes a solution to the issue discussed in the Katalon Forum: How to highlight test object in each and every step The originator asked:

I have created a keyword to highlight testobject. Please tell me how to call this keyword globally in such a way that it should highlight testobject of each step during test case execution

He proposed a custom keyword implementation which give highlight to a specific HTML element on a page provided with a TestObject.

Problem to solve

The originator wrote:

it should highlight testobject of each step during test case execution

This implies that he do not like such code:

WebUI.openBrowser('')
WebUI.navigateToUrl('https://katalon-demo-cura.herokuapp.com/')

// highlight a specific element
CustomKeywords.'com.kazurayam.ksbackyard.HighlightElement.on'(
	findTestObject('Object Repository/Page_CURA Healthcare Service/h1_CURA Healthcare Service'))

CustomKeywords.'com.kazurayam.ksbackyard.HighlightElement.on'(
	findTestObject('Object Repository/Page_CURA Healthcare Service/a_Make Appointment'))
WebUI.click(findTestObject('Object Repository/Page_CURA Healthcare Service/a_Make Appointment'))

CustomKeywords.'com.kazurayam.ksbackyard.HighlightElement.on'(
	findTestObject('Object Repository/Page_CURA Healthcare Service/input_Username_username'))
WebUI.setText(findTestObject('Object Repository/Page_CURA Healthcare Service/input_Username_username'),
	'John Doe')

CustomKeywords.'com.kazurayam.ksbackyard.HighlightElement.on'(
	findTestObject('Object Repository/Page_CURA Healthcare Service/input_Password_password'))
WebUI.setEncryptedText(findTestObject('Object Repository/Page_CURA Healthcare Service/input_Password_password'),
	'g3/DOGG74jC3Flrr3yH+3D/yKbOqqUNM')
...

Probablly he would not like invoking Custom Keyword which puts highlight on HTML element on the page for each indivisual HTML elements. It's boring, cumbersome, untidy.

Possiblly he would want all of the HTML element targeted by WebUI.click(), WebUI.setText() and WebUI.setEncryptedText() are highlighted automatically, silently.

Solution

I have developed a custom keyword class com.kazurayam.ksbackyard.HighlightElement. This class implements 2 methods:

  1. on(TestObject to)
  2. pandemic()

The on(TestObject to) method puts highlight on the specified HTML element.

The pandemic() method internally overrides WebUI.click(TestObject to) and other methods so that each keywords automaticall calls on(TestObject to) before its method body.

Description

How to run the demo project

run Test Suites/TS1. Then you will see the demo running.

Or click this link to see the movie

How the code implemented

  1. Test Cases/TC1
  2. Keywords/com.kazurayam.ksbackyard/HighlightElement.groovy

I would not talk much about the code. It uses magical Grovy ExpandoMetaClass.

A warning: if you read Keywords/com.kazurayam.ksbackyard/HighlightElement.groovy, you will see the pandemic() method can be very lengthy. It's is not as easy as you would expect.

Built-in Keywords that are influenced

In the version 0.3, the pandemic() method influences the following Katalon built-in keywords:

You can’t perform that action at this time.