Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
Introduction
2.
Mobile Objects
3.
Manage Mobile Test Objects in Katalon studio
3.1.
Why do we use Katalon for Mobile Testing Automation?
3.2.
KATALON STUDIO VERSION 7.6
3.2.1.
Create a Mobile Object​​​
3.2.2.
Validate the test object
3.2.3.
Add the Object's property
3.2.4.
​​​In Script View
3.3.
KATALON STUDIO VERSION before 7.6​​
3.3.1.
Create a Mobile Test Object and its locator
3.3.2.
Add an object's property
3.3.3.
Validate Test Object on AUT
3.3.4.
In Script View​
4.
Frequently Asked Questions
4.1.
What are some common challenges in mobile application testing?
4.2.
What are some common bugs found while mobile testing?
4.3.
When to choose manual testing?
5.
Conclusion
Last Updated: Mar 27, 2024

Manage Mobile Test Objects in Katalon studio

Author Komal
0 upvote
OG Image

Introduction

In this blog, We will be understanding the concept of Mobile Test Objects and How to manage them in Katalon Studio. So, get ready to learn something new and practical!

How to manage mobile test objects in Katalon/

 Let’s begin, shall we?

Mobile Objects

Let us begin by getting our concepts straight about Mobile Test Objects.

Image depicting Mobile Objects

 

The Mobile object provides access to all the mobile devices connected to the machine. We can specify the current device for the test with the help of their methods which also allow us to get scripting access to it.

Manage Mobile Test Objects in Katalon studio

Why do we use Katalon for Mobile Testing Automation?

We use Katalon for Mobile Testing automation because of the following reasons:

  1. Simple Setup - Katalon Studio comes with all the components and prebuilt keywords to automate your mobile project instantly.
  2. Appium Compliant - Katalon Studio supports all the latest mobile platforms and devices as well as the Appium-based rich ecosystem.
  3. Powerful Object Spying UtilityThe UI elements are effectively detected and stored to speed up the scripting process and lessen the maintenance efforts.
  4. Robust Recording Utility - In Katalon Studio, we can easily generate the tests with the mobile recorder and automatically store all the UI elements to be used again.
  5. Optimal Cross-Functional Testing -In Katalon Studio, we can increase Automation efficiency with the help of reusable test objects and scripts across API, web, and mobile platforms.
  6. Cross-Environment Execution - In Katalon, tests can be run locally or remotely with real devices, simulators, or even cloud-based devices.
  7. Cloud-Based Mobile Platform IntegrationIntegration with other mobile platforms, e.g., Sauce Labs, LambdaTest, etc., is easy.

Katalon Studio Logo

Let us now look into the main concern of our blog - ‘Managing Mobile Test Objects in Katalon Studio’. Take a look at the following few steps: 

KATALON STUDIO VERSION 7.6

Create a Mobile Object​​​

  1. After opening the project, firstly, we need to Create a Mobile Object. Right-click on the Object Repository and then New > Mobile Object.

 Image showing how to create a Test Object

2. As soon as we select the Mobile Object option, a dialog box pops up wherein we need to provide the name and description of the Mobile Object.

Giving name to the mobile object

3. After that, we need to provide ‘Locator’ and ‘Object Properties’ to our Mobile Object. In the Locator section, we have two fields to fill-

  • ‘Locator Strategy’ gives us a list of options to choose from; we choose 'XPATH’.
  • ‘Locator’- The locator should be unique in detecting that object.

Image depicting newly created mobile Object and locator properties

Validate the test object

Next, we need to Validate the Test Object.

We have to add the Test Objects to 'Mobile Object Spy.' Right-click on the object/item to open the menu, where you will find the option of adding the test object to Mobile Object Spy.

Test Objects are added to the Mobile Object Spy to check if the Object can be detected successfully in the application under the test execution.

Image depicting how to validate a mobile Object

Add the Object's property

Multiple object properties can be added to the Object's Properties schema. Object properties cannot have the same name in an object.

To add an Object Property, click on Add. As soon as we click on Add, a dialog box pops up:

Image depicting how to add object properties

You need to fill in the required information-Name & Value

  • Name: It is the name of the object property. You have to enter the name manually.
  • Value: Give the value corresponding to the name of the object.

After pressing Ok, we see that the property we added is listed in the table.  We can add more properties. We can edit, delete or clear the existing ones.

Note: The most significant property of an object is its locator strategy and value.

​​​In Script View

We can define and handle the Test Objects programmatically with the help of Script View:


import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.testobject.MobileTestObject
import com.kms.katalon.core.testobject.MobileTestObject.MobileLocatorStrategy
// We can either find an object which is already defined in Object Repository using findTestObject
predefinedObject = findTestObject('android.widget.TextView - App')
// We can create a new mobile object programmatically
MobileTestObject mto = new MobileTestObject("TestObjectID")
//defining the locator strategy
mto.setMobileLocatorStrategy(MobileLocatorStrategy.XPATH)
//setting the unique locator
mto.setMobileLocator("//android.widget.TextView[(text() = 'App' or . = 'App')]")

KATALON STUDIO VERSION before 7.6

Create a Mobile Test Object and its locator

Firstly, select FileNewTest Object from the main menu.

Image depicting how to create Test Object

New Test Object dialog box pops up wherein we need to provide a name for the new test object and then click the Ok button.

Image showing how to give a name to the Test Object

After clicking Ok, we observe that a new Test Object is created in the Object Repository.

Image depicting the newly created Test Objects

‘Attributes’ is selected by default to locate mobile test objects. 

Several properties make up a Test Object based on which Katalon Studio detects an object during test execution.

Add an object's property

Multiple object properties can be added to the Object's Properties table. It’s important to note that object properties cannot share the same name in an object.

  1. We can add properties in the Object’s Properties panel by clicking on ‘Add’
  2. As soon as the ‘Add property’ dialog box pops up, We need to fill in the required information:
     

Image depicting how to add object properties

Image showing how to add object properties

 

  • Name: Name the object property. You can choose one of the options from the dropdown list (class, css, id, name, title, xpath) or manually enter a name.

Image showing how to select or enter the name for the Test Object

  • Match condition: The condition helps in detecting the target object during execution time.
  • Value: The value that completes a match condition goes here.

After clicking on ‘Ok’, the new property is added to the properties list. You can also edit the properties' values here.

Validate Test Object on AUT

Test Objects are added to the Mobile Object Spy to check if the object can be detected successfully in the application under the test execution.

Right-click on the object/item to open the menu, where you will find the option of adding the test object to Mobile Object Spy

Image depicting how to validate Test Object

 

In Script View

We can define and handle the Test Objects programmatically with the help of Script View:

//Refer to existing objects using the findTestObject() method:
// This is to find an object which is already defined in Object Repository
predefinedObject = findTestObject(‘android.widget.TextView - App’)
//Or we can create a new object programmatically using the'TestObject' class:
newObject = new TestObject(“ObjectID”)
// Using addProperty() ,add property to the Test Object - property name, condition type, property value,a boolean value
newObject.addProperty(“class”, ConditionType.EQUALS, “android.widget.TextView”, true)

Frequently Asked Questions

What are some common challenges in mobile application testing?

  • Test cases execution with different operating systems
  • Testing the applications on various mobile networks
  • Different ways are required to test different application types like hybrid, web app, or native

What are some common bugs found while mobile testing?

  • Critical: Crashing of your phone system
  • Block: Unable to use the phone until it’s rebooted
  • Major: Not being able to perform a function of a specific feature
  • Minor: Usually, the GUI bugs fall under minor bugs.

When to choose manual testing?

We choose Manual testing when the application has some new functionality or requires testing to be done once or twice.

Conclusion

We hope this blog helped you prick your brain on How to manage Mobile Test Objects in Katalon. The blog introduces you to the concept of Mobile Test Objects and how to manage them in Katalon Studio.

Refer to the Basics of C++ with Data StructureDBMS, and Operating System by Coding Ninjas, and keep practicing on our platform Coding Ninjas Studio. You can check out the mock test series on code studio.

You can also refer to our Guided Path on Coding Ninjas Studio to upskill yourself in domains like Data Structures and AlgorithmsCompetitive ProgrammingAptitude, and many more! Refer to the interview bundle if you want to prepare for placement interviews. Check out interview experiences to understand various companies' interview questions.

Give your career an edge over others by considering our premium courses!

Happy Learning!

 

Thankyou Image
Live masterclass