Create test case using Script Mode

In addition to the Manual view, Katalon Studio allows expert users to programmatically write automation test in the test case Script view. Users with Groovy/Java background can easily edit test scripts in this view.

This tutorial walks you through the steps needed to manually write a very basic automation test script using Katalon Studio. After reading this article, you will understand and be able to use import statements and built-in keywords to compose test scripts. It's recommended that you have some basic scripting background, preferably using Groovy, to efficiently use the scripting capability.

Given a sample test case with the following steps:

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

Follow these steps to automate the above test scenario in Script view:

  1. Select File > New > Test Case from the main menu. Provide the name for the new test case. Click OK.

new test case Katalon Studio

2. Once a new test case is created, switch to the Script view. Test steps specified in the Manual view are automatically translated to Groovy script in the Script view.

Script mode Katalon Studio

The import statement in a test script allows referencing to classes to be used. Expand the import section to see all default imported classes by Katalon Studio. The name after 'as' in each import statement is an alias for the class. You can change the alias for each class. These classes are necessary for composing a test script.

Katalon Studio is an automation tool that supports keyword-driven testing. All keywords are grouped into WebUI, Mobile and WebService packages accordingly. Press Ctrl + Space to view these packages and functions from the imported classes.

3. In this scenario, you will create a Web application test script to make use of the Web UI built-in keywords. To use a built-in WebUI keyword, enter the following syntax into the editor:


  1. After entering the dot character (.), all built-in keywords and their description for Web UI testing will appear as below:

Content Assist Dialog Katalon Studio

  1. Select the Open Browser keyword. This keyword opens a browser and navigates to the specified URL if it is provided. The details for the selected keyword will be shown in a popup screen.

Open Browser Katalon Studio

  1. Enter the Navigate To URL keyword. This keyword navigates to a specified URL. For now, enter the URL of Katalon Studio ( as the value of the parameter.

Navigate URL keyword Katalon Studio

  1. Enter Click. This keyword represents the click action on a given object. You need to specify an object for this action.

Click keyword Katalon Studio

  1. Use the following syntax to refer to an object in Object Repository (alternatively, you can drag and drop the object to test case editor to generate the syntax):
findTestObject('{Object ID}')

Object ID is the ID of that object in Katalon Studio.

9. You can find an Object ID from its Properties dialog. For example:

Object ID Properties

  1. Enter the Verify Element Present keyword to validate if a certain object is displayed on the executing browser. Similar to the previous step, you need to specify the object to be used with this keyword.

Verify element present

  1. Add the Close Browser keyword and save your test case.

Close Browser keyword

  1. You may find these API docs useful while working with scripts:
Class DescriptionDescription
Built-in Keywords List of common built-in keywords
Web UI Built-in Keywords List of Web UI built-in keywords
Web Service Built-in Keywords List of Web Service built-in keywords
Mobile Built-in Keywords List of Mobile built-in keywords

13. Congratulations! You have finished your first automation script in Groovy language. Click Run in the main toolbar to execute the test case.

Run Katalon Studio

The test execution results are shown in Log Viewer as below:

Test execution Dialog