Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
Introduction
2.
Manual View
2.1.
Usage Example
3.
Script View
3.1.
Usage Example
4.
Frequently Asked Questions
4.1.
What do the Open Browser and Close Browser keywords do?
4.2.
How to capture test objects in Katalon Studio?
4.3.
What other components can be added to a test step other than keywords?
5.
Conclusion
Last Updated: Mar 27, 2024
Easy

Generate Test Steps in Manual and Script View in Katalon Studio

Author Yashesvinee V
0 upvote

Introduction

Ever wondered, what functional automation testing technique is used in Katalon to describe the actions of a test case? The answer is keyword-driven testing

In Katalon, test cases contain keywords that represent the actions of users on the AUT or Applications Under Test. Test cases are performed sequentially as test steps that describe every step involved in a test case execution. Let us see how to create test steps in Katalon.

Generate Test Steps in Manual and Script View in Katalon Studio

Manual View

Step 1: Click on Add in the Test Case Editor of the Manual tab. A new line for a test step gets generated.

Step 2: Search and select a keyword. Enter the InputOutputObject and Description for the test step if required.

Step 3: After adding all the test steps, click on the Run button in the main toolbar to execute the test.

Additional features to move up, down, and delete test cases are provided. Users can instantly add the ten most recently used keywords in the list using the  Recent Keywords option next to the Add option. The studio also allows users to select recently sued objects or object folders from the object repository. To do so, double-click on any test object from the Object column. Click on Recent in the dialogue box that appears. The Test Object option will display the five most recently selected objects, and the  Object folder option will display the names of the five most recently opened object folders.

Keywords in Manual View

Usage Example

Let’s assume a sample test case that does the following.

  • Open the browser.
  • Navigate to a website.
  • Click on a specific control.
  • Validate if the control exists on the page.
  • Close the browser.
     

Step 1: Search for the Open Browser Keyword.

Step 2: Select the Navigate to Url keyword on the next line. Click on the Input cell. Give a parameter name and its type. Enter a URL in the value field and click on Ok.

Step 3: In the next line, select the Click keyword. Objects are stored in the Object repository. Click on the Object cell to choose an object.

Step 4: Search for Verify Element Present keyword on the next line. And specify the object for it.

Step 5: Select the Close Browser keyword as the final test step and save the test case.

Test Steps in Manual View

Script View

Test cases can be viewed in the Groovy script in the Script View. The displayed script contains an import statement to import the default classes in Katalon Studio. Packages like web UI, web services, windows, cucumber and mobile are used to group keywords. The imported packages and functions in the script can be viewed by pressing CTRL+Space. A dot separates the group keyword and built-in keyword (.). The Content Assist function provides suggestions to complete the code after the dot character is used.

Test Steps in Script View

Referring to an Object in the Script view requires an object ID, which can be found in the Properties dialogue of an object from the object repository. The script to refer to an object is findTestObject('{Object ID}').

Usage Example

Consider the same sample test case as before.

  • Open the browser.
  • Navigate to a website.
  • Click on a specific control.
  • Validate if control exists on the page.
  • Close the browser.
     

Step 1: In the Script tab, type WebUI.open and select the openBrowser keyword from the suggestions displayed.

Step 2: Type WebUI.nav and select navigateToUrl. Enter any URL as the parameter within the parentheses.

Step 3: Enter WebUI.click(findTestObject()) and specify the object as its parameter.

Step 4: Type WebUI.verify and select verifyElementPresent. Enter the object as its parameter.

Step 5: Enter WebUI.closeBrowser() and save the test case.

Frequently Asked Questions

What do the Open Browser and Close Browser keywords do?

The Open Browser Keyword opens a browser window and directs the user to a URL specified in its rawUrl parameter. The Close Browser keyword closes all browser windows.

How to capture test objects in Katalon Studio?

The Spy Web Utility uses properties and location methods to capture test objects and manually define them.

What other components can be added to a test step other than keywords?

A test step can take a Statement or call other test cases. Statements can be for decision-making, looping, branching, and exception handling.

Conclusion

This blog discusses generating test steps in Manual and Script view in Katalon Studio. It explains how to create test steps in each view with an example. Check out our articles on Search and Call test cases in Katalon, Sample API tests project in Katalon and Sample Cucumber test project in Katalon. Explore our Library on Coding Ninjas Studio to gain knowledge on Data Structures and Algorithms, Machine Learning, Deep Learning, Cloud Computing and many more! Test your coding skills by solving our test series and participating in the contests hosted on Coding Ninjas Studio! Looking for questions from tech giants like Amazon, Microsoft, Uber, etc.? Look at the problems, interview experiences, and interview bundle for placement preparations. Upvote our blogs if you find them insightful and engaging! Happy Coding!

Thank you 

Live masterclass