Tutorial On Web Testing with Katalon Studio – Devstringx

Back to Blog
Katalon Studio

Tutorial On Web Testing with Katalon Studio – Devstringx

Web Testing with Katalon Studio

Katalon Studio is an integrated development environment (IDE) for automated test generation, where we can create, execute and view reports for our automated test. With both manual view and scripted view, It is suitable even when we have little programming experience.

With Katalon Studio, We can do the following:

  1. Web testing
  2. Mobile testing for Android and iOS
  3. API testing
  4. Desktop app testing
  5. Data-driven testing
  6. BDD testing

Steps of Web Testing with Katalon Studio

By following 06 easy steps we can complete our web testing process with Katalon studio.

1) Set Up a Project

In Katalon Studio, We can create a new project from scratch or from one of the sample projects we provided. Click on File > New > Project and select your preference. Then, enter the name of the new project and the location to store the project data.

2) Create the First Test Case

Right-click on Test Cases > New > Test Case, Test cases in Katalon Studio can be written in pure Selenium format:

WebDriver driver = new ChromeDriver();

String baseUrl = "https://www.katalon.com/";

driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

driver.get("https://katalon-demo-curas.herokuapp.com");

driver.findElement(By.id("btn-appointment")).click();

driver.findElement(By.id("txt-username")).clear();

driver.findElement(By.id("txt-username")).sendKeys("Diksha");

driver.findElement(By.id("txt-password")).clear();

driver.findElement(By.id("txt-password")).sendKeys("NotAPassword");

driver.findElement(By.id("btn-login")).click();

driver.quit();

Click Run to see how it works.

To simplify and speed up the process of writing test cases, especially in high volume, we can use Katalon Studio standard format. For example:

WebUI.openBrowser('

https://katalon-demo.com

)

WebUI.click(findTestObject('PageCURA Bodycare Service/a_Make Appointment'))

WebUI.setText(findTestObject('PageCURA Bodycare Service/input_Username_username'), 'John Doe'

WebUI.setEncryptedText(findTestObject('Page_CURA Bodycare Service/input_Password_password'), 'g3/DOGG74jC3Flrr3yH+3D/yKbOqqUNM')

WebUI.click(findTestObject('Page_CURA Bodycare Services/button_Login'))

Click Run to see how it works. Next, we will go through the “ChromeDriver,” “click” and “findTestObject” methods, and how to use the “Page_CURA Bodycare Service/a_Make Appointment” argument to begin testing with Katalon Studio.

Browser drivers: The browser driver,  i.e., ChromeDriver is abstracted away from the code and set up at the execution time so that the code is enabled for cross-browser testing.

Click and setText: This is an example of Katalon’s Studio’s open-source built-in keywords library to wrap and enhance the limited set of Selenium keywords. We can also create our own set of custom keywords or import the shared custom keywords made by other users.

Page_CURA BodyCare Service/ a_Make Appointment: These are the test objects designed to follow the Page Object Model pattern. Katalon Studio supports our test objects with the “auto-healing” feature to make them sustainable, despite the continuously changing nature of the AUT. The script and objects above can quickly be generated by the Recording and Spying

Read Also – Handling Shadow DOM in Selenium

Katalon Studio can be used for both manual and automation testing. It provides a dual-script interface for both manual and automated tests

In practice, a team of testers and developers can apply these steps for their complete workflow:

Firstly, the automation experts will prepare scripts needed to build test cases such as custom keywords, test listeners, calling test cases, etc.

Then, these prepared scripts will be transferred to the manual QAto utilize without handling a script.

As a result, the manual QAs can gradually learn how to script and become automation Testers.

3) Verification in The Test Case

To get the result of the login process, we need to add the verification script to the test case.

As the fundamental of scripting in Katalon Studio for the first test case has explained, we can move on to another test case: “Make Appointment” header verification.

We can leverage Katalon Studio’s rich set of verification keywords to work on that requirement. this kind of script can be done in both Manual and Scripted mode.

WebUI.verifyElementText(findTestObject('Object Repository/Page_CURA Bodycare Service/h2_Make Appointment'), 
'Make Appointment', FailureHandling.STOP_ON_FAILURE)

4) Debugging The Test Case

Try changing the verification text to “Make another Body Care Appointment.” to make the test case fail. Here are a few options of how you can check the reasons for failure in Katalon Studio:

  • Option 1: Investigate error logs
  • Option 2: Debug mode

For the complex case, Katalon Studio offers a debug mechanism that works similarly to the code debug mechanism in the advanced developer IDE.

  • Option 3: Manual debug

It is possible to use the recording feature of Katalon Studio for debugging. The Katalon Studio supports recording the failed test case, running the error test step for us to analyze and fix the issue directly in the recording mode.

Here’s an example:

When your test case failed, click “Yes, I do” in the window that will show up to continue recording the failed test cases.

Choose to Run all steps to run the error test steps. After that, we can investigate and fix that issue directly in the recording mode.

Read Also – Create Test Cases In Katalon Studio

5) Plan the Test Cases in The Test Suite

  • Right-click Test Suite > New > Test Suite

To create test cases with multiple configurations (e.g., retrying on failure, email sending, or data-driven binding), use the test suite capability. The added configuration of a test suite execution can be managed by expanding the Execution Information section.

6) Execute Test Suites and View the Result

  • Select Test Suite > Run

The final step is to execute a test case in the designed test suites:

After being successfully planned, the test suites or test suite collections can be executed directly in Katalon Studio.

Share this post

Back to Blog