Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
Introduction
2.
Create test case overview
3.
Creating a new test case
4.
Generate test steps in Manual View
4.1.
Creating a sample test case in manual view
4.2.
Recent objects and object folders
5.
Generate Test Steps in Script View
5.1.
Built-in Keywords
5.2.
Example: Generate test steps in the script view
6.
Frequently Asked Questions
6.1.
What is the use of recent keywords?
6.2.
What does the Test Object Input dialog box display?
6.3.
When is the Content Assist function invoked in Katalon Studio?
7.
Conclusion
Last Updated: Mar 27, 2024
Easy

Creating a Test case in Katalon Studio

Introduction

Hello, Readers!!

Have you guys heard about Katalon Studio?

No? Don’t worry, we got you covered. Katalon Studio is a robust automation tool with a Selenium-based engine. It is designed in order to create and reuse automated test scripts for UI without needing to code. 

In this blog, we will discuss how we can create a new test case in Katalon Studio.

So let us begin!

Creating a Test case in Katalon Studio

Create test case overview

Katalon Studio supports Keywords-Driven testing, where the test case consists of keywords that represent the actions of users on the Applications Under Test. Users with less programming experience can use the Manual view to generate automated tests. It also allows Java/Groovy experienced users to programmatically write as well as modify automated tests in the script view of the test cases.

Creating a new test case

In order to create a new test case, the user first needs to open the desired Katalon Project. The Tests Explorer section, which contains access to all folders of the projects, is on the right side of Katalon Studio, do the below-mentioned steps in that section:

  • Right-click on the Test Cases folder option and select New > Test Case. Or the user can navigate to File > New > Test Case from the main menu.
  • The New Test Case dialog box will open. Enter the details required, such as test case name, description, and tags. These details help the user to organize their project more efficiently. Once the details have been entered, click OK. A New Test Case will be created inside the Test Case folder.
New Test Case dialog box

Source: Katalon Docs

  • After a new test case is created, it gets opened in the Manual View. The manual view allows the user to create automated tests even with little programming skills. The user can also switch to the Script tab in order to edit in the Script view.

Generate test steps in Manual View

Follow the below-mentioned steps to create test steps in Manual view:

  • Click on the Add option in the Manual tab of the Test Case Editor. A new line representing a test step will be generated.
  • In the newly created test step, either type a keyword or choose a keyword from the dropdown. The user can add an object, input, output, or description for the test step.
  • Repeat the above steps to add more test steps. The user can move up or down and can even delete a test step.
  • In order to execute a test case, click on Run from the main toolbar

Creating a sample test case in manual view

Follow the below-mentioned steps in order to create a test case using the manual mode:

  • Navigate to File > New > Test Case using the main menu. The New Test Case dialog box will open, enter the required details and click on OK.
  • Once a test case has been created, it is opened in the Manual View. It allows users with little programming skills to create automated tests.
  • Select Add > Web UI Keyword from the command toolbar. The user can also choose from the Recent keywords, which are the last ten currently used keywords in the item list.
  • Then click on the Open Browser keyword. This will open the browser and redirect to the specified URL, if any.
  • Then add the Navigate to URL keyword. This will navigate to the specified URL. The user can provide additional data for the keyword by double-clicking on the input cell.
  • The Input dialog box will be displayed.
Input dialog box

Source: Katalon Docs

  • Then add the click keyword. This represents the click action on the given object. The user needs to provide an object for the click keyword. Double-click on the object cell in order to open the Test Object Input dialog box.
  • The Test Object Input dialog box displays all of the captured objects in the Object Repository. Select your object and then Click on OK.
  • Then add the Verify Element Present. This will validate if the specific object displays on the executing browser. The user needs to provide an object for this keyword.
  • Finally, add the Close Browser keyword and Save the test case.
  • Click on Run in order to execute the test case.

Recent objects and object folders

Users can quickly select the recently used objects or even jump directly to the recently used object folder in the object repository when working in Katalon Studio. To open the Test Object Output dialog, double-click on any Test object in the object column. The Recent Object button is in the top right corner.

Test Object Output dialog box

Source: Katalon Docs

The recent list has two sections: Object Folder and Test Object

  • Test Object: it displays the names of the last five selected objects.
  • Object Folder: it displays the names of the five folders which contain any recently used objects.

Generate Test Steps in Script View

A user can switch to the Script view by using the corresponding tab, which is at the bottom of the test case editor, once a new test case is created. The test steps which are specified in the Manual view get translated into a Groovy script in the Script view.

Users can refer to the classes they want to use by using the import statement in the test script. All of the default imported classes can be viewed by expanding the import section. 

Built-in Keywords

Since Katalon Studio is an automation tool that supports keyword-driven testing, all keywords are grouped into WebUI, mobile, etc. Users can view the packages and functions from the imported classes by pressing Ctrl + Space. In order to use a built-in keyword, the user needs to type the group keyword. Katalon Studio has a content assist function, which is invoked after the user enters the dot character. It provides users with a context-sensitive suggestion for code completion.

Example: Generate test steps in the script view

Follow the below-mentioned steps to create a Web application test script to make use of the WebUI built-in keywords:

  • Type WebUi and then select the Open Browser keyword. This will open the browser and redirect to the specified URL if any. 
  • Then enter the Navigate to URL keyword. This will navigate to a specified URL. For example, enter the URL of Katalon Studio as the value of this parameter.
  • Then enter the Click Keyword. This represents a click action on a given object. The user needs to specify an object for this action.
  • Then enter the Verify Element Present keyword. This will validate if any object is displayed on the executing browser.
  • Then add the close browser keyword and save the test case.

Frequently Asked Questions

What is the use of recent keywords?

The recent keywords allow the user to quickly add any of the last ten recently used keywords in the item list.

What does the Test Object Input dialog box display?

All of the captured objects in the Object Repository are displayed by the Test Object Input dialog.

When is the Content Assist function invoked in Katalon Studio?

The content assist function gets invoked after the user enters the dot character.

Conclusion

In this article, we have extensively discussed the Different ways in which we can Create a Test case in Katalon Studio.

After reading about the Different ways in which we can Create a Test case in Katalon Studio, are you not feeling excited to read/explore more articles on APIs? Don't worry; Coding Ninjas has you covered. 

If you wish to enhance your skills in Data Structures and AlgorithmsCompetitive ProgrammingJavaScript, etc., you should check out our Guided path column at Coding Ninjas Studio. We at Coding Ninjas Studio organize many contests in which you can participate. You can also prepare for the contests and test your coding skills by giving the mock test series available. In case you have just started the learning process, and your dream is to crack major tech giants like Amazon, Microsoft, etc., then you should check out the most frequently asked problems and the interview experiences of your seniors that will help you in landing a job in your dream company. 

Do upvote if you find the blogs helpful.

Happy Learning!

Thank you

Live masterclass