This tutorial provides the steps needed to manually write a very basic automation test script using Katalon Studio.
Make sure you already downloaded Katalon Studio at www.katalon.com
Scenario:
- Open a browser
- Navigate to a website
- Click on certain control
- Validate if the control exists on the page
- Close the browser
Here’s how you can automate the above test scenario in Scrip view:
Step 1: Go to File > New > Test Case on the main toolbar.
Enter the test case name, and then click “OK.”
Step 2: Switch to the Script view after creating the new test case. Test steps specified in the Manual view are automatically translated to Groovy script in the Script view.
*Notes:
- The import statement in a test script allows referencing classes to be used.
- You can see all the default imported classes by Katalon Studio by expanding the section.
- An alias for the class is the name after “as” in each import statement. It can be changed for each class. These classes are essential 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 package accordingly. Press Ctrl + Space to view these packages and functions from the imported classes.
Step 3: To make use of the Web UI built-in keywords, create a Web application test script. Put in syntax (= WebUI) into the editor to use a built-in WebUI keyword.
Step 4: Enter the dot character (.) to show all built-in keywords and their description for Web UI testing.
Step 5: Enter the Open Browser keyword. If the URL is provided, this keyword will open a browser and navigates to the previous specified URL. You will see the details for the selected keywords show up in the popup screen as shown below.
Step 6: Enter the Navigate To URL keyword. This keyword navigates to a specified URL. For now, enter the URL of Katalon Studio (katalon.com) as the value of the parameter.
Step 7: Enter Click keyword. This keyword represents the click action on a given object. You need to specify an object for this action.
Step 8: To generate the syntax, you can drag and drop the object to the test case editor or you can directly use the following syntax to refer to an object in Object Repository
findTestObject(‘{Object ID}’)
*Note: Object ID is the ID of that object in Katalon Studio.
Step 9: Finding an Object ID from its Properties dialog. For instance:
Step 10: To validate if a certain object is displayed on the executing browser, enter the Verify Element Present keyword. Same as the previous step, you need to associate this keyword with an object.
Step 11: Add the Close Browser keyword and save your test case.
Step 12: These API docs would be useful to you 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 |
Step 13: To execute the test case, click “Run” in the main toolbar.
The test execution results are shown in the Log Viewer, as below:
Congratulations! You have finished your first automation script in Katalon Studio. Stay tuned for the next tutorial: Creating test cases using Manual Mode.
>>> Checkout Katalon Tutorial List <<<
⇓ Subscribe Us ⇓
If you are not regular reader of this website then highly recommends you to Sign up for our free email newsletter!! Sign up just providing your email address below:
Happy Testing!!!
- Creating test cases using Record and Playback
- Creating test cases using Manual Mode
- Start Your API Testing Project with Katalon Studio
- Tutorial 1 – Introduction to FitNesse Testing Tool
- Katalon Studio 7: A Glance Over Top 7 Advanced Features
- Start your Desktop Apps Testing with Katalon Records feature
- How Katalon Smart Wait feature can handle web loading issues?
- Codeless Test Automation – Going Beyond with Migrating Selenium Tests to Katalon Studio
- Installation of TestNG in Eclipse – Selenium WebDriver Tutorial
- Start your Web testing project with Katalon Studio