Do you think IIT Guwahati certified course can help you in your career?
No
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.
Handling Drag and Drop in Mobile App
In this article, we will learn drag and drop action. How to handle these actions using Katalon Studio in a mobile application is discussed below. Let’s start.
Scenario
Let's assume a scenario to understand the process. A draggable object with "CodingNinjas" text is written inside it. There is also a droppable object with "Code Well" text written inside it. We have to drag and drop these objects.
Start the Drag and Drop.apk application.
Click on the text Basic Usage playground.
Drag the text CodingNinjas to drop it at text Code Well.
Manual Mode
We have to follow the following steps to understand the drag-and-drop action with Katalon Studio Mobile App:
Click from the mobile keyboard on Start Application. Then click on Input. A new dialog box will open. Select Variable as 'Value Type' in appFile. The variable name will be passed as 'path' in the Value.
Insert a Wait For Element Present item. It will allow us to wait till the Basic Usage playground pops up.
From the mobile keyword, select Tap. Now pass the Basic Usage playground object.
Again, insert a Wait For Element Present item. This is to wait for the text 'CodingNinjas.'
Choose the DragAndDrop keyword. It will allow you to perform the drag & drop action.
You can drag the draggable object into the droppable object.
You can automate the test using the Script feature.
Script Mode
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.configuration.RunConfiguration as RunConfig
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mbl
import com.kms.katalon.core.model.FailureHandling as ErrorHandling
'Path of the Apk File Store in path variable.'
def path = RunConfig.getProjectDir() + '/Data Files/Drag and Drop.apk'
'Start the Application'
Mbl.startApplication(path, false)
'Wait for Element Present of text "Basic Usage playground"'
Mbl.waitForElementPresent(findTestObject('Drag Sort Demos/Handle Drag and Drop/text_Basic Usage playground'), 30)
'Verify Element visible of "Basic Usage playground"'
Mbl.verifyElementVisible(findTestObject('Drag Sort Demos/Handle Drag and Drop/text_Basic Usage playground'), 30)
'Tap on "Basic Usage playground"'
Mbl.tap(findTestObject('Drag Sort Demos/Handle Drag and Drop/text_Basic Usage playground'), 30)
'Wait for Element Present of "CodingNinjas"'
Mbl.waitForElementPresent(findTestObject('Drag Sort Demos/Handle Drag and Drop/text_CodingNinjas'), 30)
'Verify Element visible of "CodingNinjas"'
Mbl.verifyElementVisible(findTestObject('Drag Sort Demos/Handle Drag and Drop/text_CodingNinjas'), 30)
'Use the dragAndDrop keyword to perform the drag and drop action.'
Mbl.dragAndDrop(findTestObject('Drag Sort Demos/Handle Drag and Drop/text_CodingNinjas'), findTestObject('Drag Sort Demos/Handle Drag and Drop/text_Code Well'),
30)
Mbl.delay(50, ErrorHandling.STOP_ON_FAILURE)
Mbl.closeApplication()
Frequently Asked Questions
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.
How do you verify in Katalon?
When you record using the Web Recorder, right-click on the text and select Katalon Studio > Verify Text Present.
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 how to handle actions in Mobile App with Katalon Studio. We started by understanding Katalon Studio. Then we covered the step-by-step tutorial to handle drag & drop action. The article also has a sample script to handle drag-and-drop action.