Katalon Studio Tutorial -- Create Test Case using Script Mode
How to create & run test in Katalon Studio using Script Mode
Step 1 - Download & Open Katalon Studio
- Download Katalon Studio from here.
- You have to Sign up in order to download Katalon Studio
- After downloading, open katalon.exe (create desktop shortcut for future)
- Click on New Project and give name to the project
- Click on OK
Step 2 - Create Test Case
- After the project is created, click on the "+" button & select Test Case
- Give name to the test case and click OK
- A window like this will be created(Test Case window)
Step 3 - Open Spy Web & record objects
- Suppose we want to test some actions of qaprovider.com , Add this URL in spy web and start recording
- A chrome window will be opened automatically
- Instead of recording actions, we will capture objects using ALT+`
- In the image I put my cursor on Got it button(I didn't click) & I pressed ALT+` to capture the object corresponding to that button
Step 4 - Open Script Mode & Write Test using WebUI keywords
- Close the Spy Web & open Script editor from Test case(see at the bottom, there is a script tab, open that)
- Inside script editor there are some default packages already imported by Katalon itself.
- We are testing a website, so we will write scripts using WebUI keywords(to open browser, close browser, verify element etc)
- Follow the keywords accordingly
- Know more about Katalon's built-in keywords from Keywords Browser
- These are some basic WebUI keyword that are present in Katalon. The format to write is WebUI.keyword(object_id)
- We can use drag & drop facility to add object_id to the keyword.
- N.B. the 0 inside braces indicates time delay
- The final test will look like this with 5 actions to perform.
Step 5 - Run the Test to validate
- Save the script & hit the Run button from toolbar
- A browser window will be opened & all the actions will be repeated automatically
- Status of every action will be displayed in the log viewer
- We have 5 actions in total & in the log viewer we can see status of each of them
So what we have done here?
We have created a test where we will open the website in browser, check the functionality of two buttons(Got it, expand_menu), verify if Become a Tester is present or not & close browser.
Everything in this test has been written in script mode. This is how we can create & execute tests in script mode in Katalon Studio.