Table of contents
1.
Introduction
2.
Data Validation
2.1.
Why validate data?
3.
Scenario
4.
Manual Mode
5.
Script Mode
6.
Frequently Asked Questions
6.1.
How do you validate text in Katalon?
6.2.
Does Katalon support mobile testing?
6.3.
Which method is used for testing mobile apps?
6.4.
What is Katalon Studio used for?
6.5.
What language does Katalon use?
7.
Conclusion
Last Updated: Mar 27, 2024

Using List to Store the Mobile Elements to Validate Data with katalon studio

Author Aditi
0 upvote
Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

Have you ever worked with any automated testing software tools? Have you ever created your API test?

This article is focused on one of these automated testing software tools, i.e., Katalon Studio. Katalon Studio is built on the open-source Selenium and Appium automation frameworks. It has a specialized IDE interface for API, mobile, web, and desktop application testing. It is an automation tool for mobile and web application testing. It can be installed easily. It can quickly run, create, maintain and report its automated tests. Katalon Studio is designed to reuse and create automated test scripts without coding. It allows the execution of automated tests for UI elements. It includes iFrames, pop-ups, and wait time. Linux, macOS, and Microsoft Windows all support launching the tool.

Let's dive into the article if you know more about Katalon Studio.

Using List to Store the Mobile Elements to Validate Data with katalon studio

Data Validation

Data Validation is checking data structure, accuracy, and integrity before using it for a business process. The results of data validation operations can give information for business intelligence, data analytics, or training a machine learning model. Additionally, it can be applied to guarantee data integrity for financial accounting or regulatory compliance.

Data can be reviewed as part of a validation process in various ways. It includes data type, structure, consistency, constraint, and code validation. Each data validation method is intended to ensure that the data satisfies the criteria for being useful. It is the measure of the quality of data. 

Why validate data?

Data validation is very important for data analysts, data scientists, and others working with data. The output of any system depends on the data. Validation ensures the accuracy of data. It means systems will produce correct output if the data set is validated. This is useful for artificial intelligence or machine learning models, business intelligence dashboards, and data analytics reports. It is also important for organization data or specific application operations. Data becomes useful with the right type of data validation.

Scenario

Let’s assume a scenario to proceed further. We want to choose the Radio button from a list. We first capture every button element into a collection to accomplish this. Then select the desired Radio button.

Manual Mode

We have to follow the following steps to validate data with Katalon Studio using lists:

  • Click Start Application from the Mobile Keyword. A window will be opened after clicking on Input. Choose Variable as Value Type in appFile. The variable name will be passed as a path in the Value.
  • Insert Wait For Element Present item.
  • From the mobile keyword, call Scroll To Text. Pass Views as the input. String type parameters are accepted by Scroll To Text.
  • Pass the Views object after calling the Tap method.
  • Now, from the mobile keyword, call Scroll To Text. After that, pass Radio Group as the input.
  • Click on Radio Group.
  • We wait for the 'Views/Radio Group' heading to become visible on the screen after clicking(tap) on 'Radio Group.'
  • To start Appium Driver using Katalon Mobile Driver, add a binary statement.
  • You need to add another binary statement to obtain all radio elements and store them in a list. Choose Value Type as 'Variable' in the Left Expression. Choose Value Type as 'Method Call' in the Right Expression. The value passed in the left expression is 'elements.' While in the right expression, the object information of the list of radio buttons is passed. 
  • Insert a for-each loop statement.
    • To store the text of each list element in the “actual_Text” variable, you need to include a binary statement.
    • Add an 'if' statement. Check whether the expected text and the actual text are identical. A click action will be performed on the Radio button if they match each other.
    • After running the click event, we should end the for-each loop. To do this, include a method call statement with the keyword "break."

Script Mode

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import org.openqa.selenium.WebElement as WebEle
import com.kms.katalon.core.configuration.RunConfiguration as RunConfig
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mbl
import com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory as MobDriverFctry
import com.kms.katalon.core.model.FailureHandling as FailHandler
import io.appium.java_client.AppiumDriver as AppDriver
  
 def pathValue = RunConfig.getProjectDir() + '/Data Files/ApiDemos.apk'
  
 Mbl.startApplication(pathValue, false)
  
 Mbl.waitForElementPresent(findTestObject('API Demos Objects/List_Example/heading_API_Demos'), 45)
  
 Mbl.scrollToText('Views', FailHandler.STOP_ON_FAILURE)
  
 Mbl.tap(findTestObject('API Demos Objects/List_Example/text_Views'), 20)
 
 Mbl.scrollToText('Radio Group', FailHandler.STOP_ON_FAILURE)
 
 Mbl.tap(findTestObject('API Demos Objects/List_Example/text_Radio Group'), 30)
  
 Mbl.waitForElementPresent(findTestObject('API Demos Objects/List_Example/text_Header Radio Group'), 30)
 
AppDriver<?> appdriver = MobDriverFctry.getDriver()
List<WebEle> element = appdriver.findElementsByClassName('android.widget.RadioButton')
 
println('Size of elements = ' + element.size())
 
for (WebEle radio: element) {
    String actual_Text = radio.getText()
     if(actual_Text.equals("Dinner"))
     {
           radio.click();
           break;
     }
}
You can also try this code with Online Javascript Compiler
Run Code

Frequently Asked Questions

How do you validate text in Katalon?

When you record using the Web Recorder, right-click on the text and select Katalon Studio > Verify Text Present.  

Does Katalon support mobile testing?

Katalon Studio is a cross-browser tool that supports mobile, web, Windows desktop, and API testing. 

Which method is used for testing mobile apps?

Agile testing is the method used to test the mobile application. The developers will release the new product for the testing team, and the testing team will run their test cases in the environment of Quality Assurance.

What is Katalon Studio used for?

Katalon is used to create and reuse automated test scripts for UI without coding. It allows running automated tests of UI elements. It can be launched on Microsoft Windows, macOS, and Linux.

What language does Katalon use?

Katalon Studio uses Groovy, a language built on top of Java. It has to load many libraries for parsing test data, objects, and logging.

Conclusion

In this article, we have extensively discussed the steps to store the Mobile elements with the Katalon studio. We started by understanding Katalon Studio. Then we covered the step-by-step tutorial to include a radio button using a list. The article also has a sample script to include the radio button. 

We hope this blog has helped you enhance your Katalon Studio knowledge. To learn more, check out our articles on introduction to API and its usageWeb API introduction, and real-world API. Practice makes a man perfect. To practice and improve yourself in the interview, you can check out Top 100 SQL problemsInterview experienceCoding interview questions, and the Ultimate guide path for interviews.

Do upvote our blog to help other ninjas grow. Happy Coding!

thank you image
Live masterclass