Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
Introduction
2.
Search Test Cases
2.1.
Search Bar
2.2.
Advanced Search
2.3.
Query Builder
3.
Call Test Cases
3.1.
Manual View 
3.2.
Script View
4.
Frequently Asked Questions
4.1.
What is a Test suite?
4.2.
What are Test Case Variables?
4.3.
Name some Failure handling options in Katalon.
5.
Conclusion
Last Updated: Mar 27, 2024
Easy

Search and Call Test Cases in Katalon Studio

Author Yashesvinee V
0 upvote

Introduction

Hey there! Hope you’re doing well. 

This blog will address how to search and call test cases in Katalon. Doing manual work is very time-consuming and inconvenient for developers. A task like searching through numerous test artefacts would be a problem. 

To smoothen out this process, Katalon Studio provides search functions to search for test artefacts based on specific filters. 

Search and Call Test Cases in Katalon Studio

Search Test Cases

Search functions in Katalon are used to search for test suites, test files and folders using criteria. We can use the Query Builder function, the advanced search option or directly set search criteria in the search bar provided. Using a search function requires the ID and tags of the test artefact.

The ID of a test artefact can be obtained by navigating to the Test Explorer, right-clicking the desired test artefact and selecting Copy ID. The properties of a test artefact and its tag is displayed in the Properties view.

Search Bar

The search bar is placed at the top of the Test Explorer. To type in the test artefact’s ID, follow this syntax:

id=(Your_Test_Case_ID)

Test Explorer

Advanced Search

The Advanced Search option is available right next to the search bar, its icon depicting a search icon with a plus sign. We can also access this function by going to Actions and selecting Advanced Search. In the dialogue box that appears, we can input our search criteria and click on Search. The Advanced Search function will query all test cases in Katalon that satisfy the given criteria.

Query Builder

Like Advanced Search, Query Builder, can filter out test cases based on specific criteria. The option to use this function is available while working in test suites. The option is present right next to the Query box. In the Query Builder dialogue box, we can search for test cases by ID, name, description, comment or tag. Enter the search criteria and click on Search. Note that searching by tag, description or comment allows only one keyword at a time.

Query Builder

Call Test Cases

While creating test steps for test cases in Katalon Studio, we can add other test cases as test steps. In this section, let us see how to do this in the Manual and Script view.

Manual View 

Step 1: Open a test case in Manual View and click on Add. Select the Call Test Case option from the dropdown that appears.

Step 2: In the dialogue box, we can see a list of all test cases accessible by the project. Select the test case to be added and click on OK.

Test Case Browser

This will add the test case as a test step. Note that we can call only one test case at a time, and once added as Call Test Case, the keyword can not be altered.

Script View

Calling a test case in the Script view requires the callTestCase method. After opening a test case in Script view, add the following code after modifying it as per the test case you need to call.

import com.kms.katalon.core.model.FailureHandling 
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase 
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI 
//Call test case using WebUI Class 
WebUI.callTestCase(findTestCase("test_case_ID"), ["key":"value", "key":"value", ...], FailureHandling.OPTION) 
//Call test case using Mobile Class 
Mobile.callTestCase(findTestCase("test_case_ID"), ["key":"value", "key":"value", ...], FailureHandling.OPTION)

The script contains three main values to call the test case. 

  • The Test case ID: This is the id of the test case.
     
  • Parameters: This is the list of input parameters to the test case. The keys and values are the test case variables and their corresponding values.
     
  • FailureHandling: It is an optional parameter that defines the action to be performed in case of a failure.

Frequently Asked Questions

What is a Test suite?

A Test Suite is a collection of test cases grouped in some logical manner. They are created and managed in Katalon TestOps.

What are Test Case Variables?

Test Case Variables are similar to programming variables. They help parameterise test cases and supply different inputs while calling them. They replace had-coded values.

Name some Failure handling options in Katalon.

The Stop on Failure option stops execution when an error occurs. The Continue on Failure option ignores any error during execution and sets a failed status. The Optional option also ignores errors but sets a Warning status.

Conclusion

This blog has covered how to search for test cases in Katalon Studio and the functions it offers. Check out our articles on Generate Test Steps in Manual and Script View, Sample API tests project in Katalon and Sample Cucumber test project in Katalon. It also describes how to call test cases in the Manual and Script view in Katalon. It explains how to create test steps in each view with an example. 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