Validation Statements With Katalon Studio

Katalon Studio supports two methods to validate: the first method is using built-in keywords to verify the states of certain test objects. Another one is to use checkpoints to verify a specific data set against a previously captured data set. This tutorial explains how to make use of these methods when designing your automation test.
Validation with Captured Objects
All Katalon Studio built-in keywords that used for validating will have a prefix “Verify…”. For example: in order to check whether a certain control present on the page, Katalon uses Verify Element Present (https://docs.katalon.com/display/KD/%5BWebUI%5D+Verify+Element+Present) keyword.
On the test case editor, you can add a validation keyword to validate a captured object. Follow these steps to add a validation point to your Katalon Test case:
1. From the Manual view, add a new keyword for your test case.
Common validation statements with Katalon Studio
 2. When the new keyword is added, scroll down to see all available Verify keywords and select the suitable one.
Katalon Studio Verify Keyword
 3. Specify the test object for the validation. The following dialog appears to allow selecting the relevant element.
Test Object Input Dialog 4. Your validation point with Verify Element Present keyword will look similar as the following example:
Verify Element Present Katalon Studio
Validation with Checkpoint
If you want to verify whether a data set is still the same, you can use checkpoints to address this.
First, you need to create a checkpoint instance. Refer to Manage Checkpoint for more details.
Katalon Studio supports a large range of data source for checkpoints such as Excel, CSV, Database and checkpoint description.
Then, you can use the Verify Checkpoint keyword to validate the state of the data. This keyword will verify if checked data of a checkpoint matches its source data. The keyword’s parameters, returns and use are described as follows:
– checkpoint – Checkpoint (required): specifies the input checkpoint.
– logChangedValues – boolean (required): specifies whether changed values between checkpoint data and the source will be logged.
– flowControl – FailureHandling (optional): specifies failure handling schema to determine whether the execution should be allowed to continue or stop. More details can be found in Failure handling (https://docs.katalon.com/display/KD/Failure+handling)
– true: if checked data of checkpoint matches its source data.
– false: if checked data of checkpoint does not match its source data.
The following example provides a manual specification and script to verify the checkpoint:
Manual specification:

import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint

'Use WebUI keyword'

WebUI.verifyCheckpoint(findCheckpoint('Checkpoints/chk_DataSnapshot'), false)

'Use Mobile keyword'

Mobile.verifyCheckpoint(findCheckpoint('Checkpoints/chk_DataSnapshot'), false)

'Use Web Service keyword'

WS.verifyCheckpoint(findCheckpoint('Checkpoints/chk_DataSnapshot'), false)


Post a Comment