Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Kickstart Automation Testing Using Katalon Studio

DZone's Guide to

Kickstart Automation Testing Using Katalon Studio

This tutorial helps beginners get started with automation testing in Katalon Studio using a sample app to walk you through the steps.

· DevOps Zone ·
Free Resource

Discover how quick and easy it is to secure secrets, so you can get back to doing what you love. Try Conjur, a free open source security service for developers.

Starting a new automation project for a website can be complicated and requires a steep learning curve, especially to those who are new to automation testing. The following tutorial will help you ease that process using Katalon Studio.

Test Scenario

For this tutorial, we are using Katalon Studio to test the dummy web app (CURA) accessible at http://demoaut.katalon.com. CURA is a simple health care service that allows patients to book appointments with doctors.

In this tutorial, we create a test case to test the following flow:

  • Login.
  • Book an appointment.
  • Check if the appointment is booked successfully.
  • Logout.

Get Started

  1. Create an automation testing project in Katalon Studio as below:

Image title

Image title

2.Create a test case, where all of your necessary test steps of a scenario will be written:

Image title

The newly created test case is generated in the form of a Groovy language script file (also called test script) which can be viewed, edited in Katalon Studio by one of two view modes: Manual View and Script View. You can start writing your testing logic from scratch

3. Composing automation test case.

Please refer to this guide for detailed instructions on how to compose test steps in various modes using different utilities. For starters, we recommend the Record – Playback function to get familiar with the scripting process. Katalon Studio Recorder is capable of generating test steps quickly and users can just focus on validation steps.

  • Click on the Record Toolbar button to open the Record dialog, then enter “http://demoaut.katalon.com” for the URL field and select Chrome on the dialog to start recording.
  • Image title

  • A new Chrome browser instance with the CURA website will be activated. Click on Make Appointment button.
  • Enter “John Doe” for username and “ThisIsNotAPassword” for password on the login page.
  • On the Make Appointment page, fill in necessary appointment information and click on the Book Appointment button to book an appointment.
  • The Appointment Confirmation page will show up. Click the Logout button to complete the recorded session.
  • Image title

  • Switch back to the Katalon Studio Record dialog and you can see all the actions and web elements recorded. Click on OK to finish the recording and generate necessary test artifacts and test scripts.
  • Image title

  • The recorded test scripts can be played back instantly and you can start the automation test right away. Click the Run button with Chrome to start running your test case.
  • Image title

    • The recorded test scripts should run smoothly, but you will notice the test is failed at step 14 (Click on “a_Logout” element) with the error message “Unable to click on object 'Object Repository/Page CURA Healthcare Service (3)/a Logout.'” Don’t worry, this can be fixed using the following steps.

    4. Complete your first test case.

    If you investigate the failed message of the test execution, it includes the message “org.openqa.selenium.WebDriverException: unknown error: Element is not clickable at point.”

    It happens because the Side Menu of the CURA website is open, and the animation causes the Log out element to appear slowly and Katalon Studio’s playback is unable to recognize it. To fix this issue, we need to include a Wait step right before the logout step using the keyword waitForElementClickable, use “a_Logout” element as the object and change the timeout input to 5 seconds.

    Image title

    Run the test case again, you will see the Logout button is found and the step is passed.

    5. Generate a report.

    To generate the test reports, we need to have a test suite. The test suite in Katalon Studio is where you can group test cases to run them together.

    • To create a test suite in Katalon Studio, click on the New toolbar button and select the New Test Suite item.

    Image title

    • In the New Test Suite dialog, enter the required name and an optional description about your test suite, click OK to create a new test suite:

    Image title

    • From the test suite UI, click the Add button and check the “Basic” test case then click OK to add the selected test case to the test suite.

    Image title

    Execute this test suite as we did with our test case by clicking on the Execution toolbar. After the execution, you will notice that a new report folder is generated. In this folder, each of the child items represents an execution with the name indicating the starting time of the execution.  Click on the first report item to view it.

    Image title

    The test report’s detail is shown as below (with “Show Test Case Details” selected)

    Image title

    Congratulations on your first automation test case. For additional tutorials and guidelines, please visit the Katalon Studio documentation. If you have any questions for your projects or recommendations for the tool, feel free to join the Forum and chat with the other users.

    Conjur is a free open source security service built by DevOps engineers. With integrations with all your favorite tools and an easy way to secure secrets, it's a no brainer. Come check it out!

    Topics:
    automation testing ,software testing ,devops ,software development ,katalon studio

    Opinions expressed by DZone contributors are their own.

    {{ parent.title || parent.header.title}}

    {{ parent.tldr }}

    {{ parent.urlSource.name }}