Integrations
Pricing
TABLE OF CONTENTS

Leveraging RPA For Katalon To Improve Testing

leveraging katalon for rpa

What is RPA?

Robotic process automation (RPA) is a software system automation approach that employs pre-programmed “bots” to automate manual tasks, typically through a user interface (UI). RPA tools are primarily used to automate business processes that once depended on human resources and were highly repetitive and operational in nature. 

 

Many of these business processes are rooted in legacy technology, which often acts as a bottleneck due to its outdated nature. As such, RPA is frequently applied on top of these legacy systems to streamline operations and reduce dependencies.  
 

What are the benefits of adopting RPA?

RPA offers several benefits to organizations that adopt it, including:

  • Increased efficiency: RPA not only automates repetitive and time-consuming tasks but also significantly improves the employee experience. With the aid of bots handling mundane activities, employees no longer have to "copy/paste" or "swivel seat" between different applications. This enables them to channel their efforts into more complex and value-added work, leading to heightened efficiency, productivity, and cost savings.
  • Enhanced precision: RPA excels in executing mundane tasks that, due to their tedious nature, may lead even the most diligent individuals to commit errors. By handling these repetitive activities, RPA ensures a high level of accuracy and consistency, minimizing the need for rework. This precision is vital in sectors like healthcare and finance, where seemingly minor mistakes can have substantial repercussions.
  • Enhanced customer experience: RPA can help organizations deliver a better customer experience by automating processes such as customer onboarding and support. This can lead to faster response times, more personalized interactions, and improved customer satisfaction.
  • Scalability: RPA can be easily scaled up or down depending on business needs. This makes it a flexible solution that can adapt to changing requirements and growth.
  • Data analytics: RPA can help organizations collect and analyze large amounts of data, providing insights into customer behavior, market trends, and operational efficiency. This can help businesses make more informed decisions and stay ahead of the competition.

How can Katalon support RPA?

Katalon is primarily known as a test automation platform for web, mobile, desktop, and API testing. However, Katalon Studio also offers features that can be used for robotic process automation purposes.

Katalon Studio provides a feature called "Record Web" which allows users to record their actions on a web application and generate a script that can be replayed later. This feature is useful in automating repetitive tasks such as filling out forms, clicking buttons, navigating through web pages, or interacting between apps.

Here are some Katalon use cases that leverage RPA:  
 

Large-scale repetitive file manipulation, extraction, and uploading use case

You can use Katalon Studio as an RPA tool to automate file manipulation, extraction, and uploading processes with a click of a button as a batch process by following these steps:

1. Open Katalon Studio and create a new test suite.

2. Add a test case for file manipulation, extraction, and uploading. 

3. Create a new Test Suite Collection by navigating to File > New > Test Suite Collection.

4. Add the test suite you created in step 1 to the Test Suite Collection.

5. Set the execution options for the Test Suite Collection to "Run with Katalon Studio" and "Run as Batch Mode".

6. Save your Test Suite Collection.

7. Now you can run your Test Suite Collection by clicking the "Run" button in Katalon Studio. This will execute your test suite and automate the file manipulation, extraction, and uploading processes.

8. To make this a batch process that can be run on the click of a button, you can create a custom keyword that runs the Test Suite Collection. Here's an example:

import com.kms.katalon.core.main.TestSuiteCollectionExecutor
public class CustomKeywords {
    @Keyword
    def static void runTestSuiteCollection() {
        TestSuiteCollectionExecutor testSuiteCollectionExecutor = new 						TestSuiteCollectionExecutor();
testSuiteCollectionExecutor.setConsoleMode(true);
testSuiteCollectionExecutor.setKeepSession(false); testSuiteCollectionExecutor.setReportFolder('Reports')
        testSuiteCollectionExecutor.setReportFileName('TestSuiteCollectionReport')
        testSuiteCollectionExecutor.execute('Test Suites/TestSuiteCollection')
    }
}

9. Save the keyword in a package called "CustomKeywords" in your project.

10. Create a new Test Case and add a step to call the custom keyword you created in step 8.

import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
CustomKeywords.'CustomKeywords.runTestSuiteCollection'( )  

11. Save your test case and add it to your Test Suite Collection.

12. Now you can run your Test Suite Collection by running the test case you created in step 10. This will execute your test suite and automate the file manipulation, extraction, and uploading processes on the click of a button.

A word about RPA bots

Orchestrated Bots are designed to be event-driven. They spring into action when triggered by specific activities, such as an incoming email to a customer service shared inbox. Once activated, they handle their set tasks and await their next trigger.

On the other hand, Attended Bots operate directly on workstations and require human initiation. Employees can trigger these bots to manage mundane tasks. Upon completion, control is reverted to the human user, enabling them to proceed with more complex or nuanced process parts.

By understanding and utilizing these bot types, you can efficiently leverage Katalon Studio as an RPA tool. This allows for the automation of file manipulation, extraction, and uploading processes, all executable at the click of a button as a batch process. Ensure you select the right bot type for your use-case to maximize efficiency and effectiveness.  
 

API call automation: Get and post information between different applications as a repetitive process

There are commercial solutions that charge customers to use their APIs at scale. It becomes a really expensive affair to buy these tools to interface with those solutions. Although these solutions have their API exposed, it’s difficult to automate a process without an RPA tool, and these tools are expensive as well. Using Katalon and CI/CD tools like Jenkins, you can make the process of extracting information from an API and storing information into a third-party tool pretty effective.

Simply follow these steps:

1. Open Katalon Studio and create a new test suite.

2. Create a new test case and name it "API Get and POST Response".

3. Add the following code to import the necessary packages and define the URL for the API: 

java
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
import com.kms.katalon.core.webui.driver.DriverFactory
import com.kms.katalon.core.testobject.ResponseObject
def url = "https://reqres.in/api/users"
 

4. Add a new "Web Service Request" step to the test case.  
 

5. In the "Request Object" field, select "New Request Object".  
 

6. Enter a name for the request, such as "API Get Request".


 7. In the "HTTP Method" field, select "GET".


 8. In the "Endpoint URL" field, enter the URL for the API.


 9. Click "Send" to execute the API request.


 10. Add a new "Response Object" step to the test case.


 11. In the "Response Object" field, select "New Response Object".


 12. Enter a name for the response, such as "API Get Response".


13. In the "Response Body" field, enter the following code to parse the JSON response and extract the data:

ResponseObject response = findTestObject('API Get Request').getResponse()
JsonSlurper jsonSlurper = new JsonSlurper()
def jsonResponse = jsonSlurper.parseText(response.getResponseBodyContent())
def data = jsonResponse.data

14. Add a new "Web Service Request" step to the test case.

15. In the "Request Object" field, select "New Request Object".

16. Enter a name for the request, such as "API Post Request".

17. In the "HTTP Method" field, select "POST".

18. In the "Endpoint URL" field, enter the URL for the API.

19. In the "Request Body" field, enter the following code to create a JSON request body with the data extracted in step 13:

 

def requestBody = JsonOutput.toJson([
    "name": data.first_name + " " + data.last_name,
    "job": "Automation Engineer"
])
 

 

ResponseObject response = findTestObject('API Post Request').getResponse()
JsonSlurper jsonSlurper = new JsonSlurper()
def jsonResponse = jsonSlurper.parseText(response.getResponseBodyContent())

20. Click "Send" to execute the API request.

21. Add a new "Response Object" step to the test case.

22. In the "Response Object" field, select "New Response Object".

23. Enter a name for the response, such as "API Post Response".

24. In the "Response Body" field, enter the following code to parse the JSON response:

ResponseObject response = findTestObject('API Post Request').getResponse()
JsonSlurper jsonSlurper = new JsonSlurper()
def jsonResponse = jsonSlurper.parseText(response.getResponseBodyContent())

 25. Save the test case and run it to automate the API Get and POST response.
 

By following these steps, you can use Katalon Studio to automate API Get and POST responses as part of an RPA process.
 

Parsing large Excel files and data mapping

To perform data loading at scale using Katalon as an RPA solution, you can use Katalon's built-in data-driven testing feature. This allows you to easily execute the same automation multiple times with different sets of data.
 

Here are the steps to perform data loading at scale using Katalon:
 

1. Create a new test suite in Katalon Studio.


 2. Create a new test case and name it “Data Loading”
 

3. Import the necessary packages for reading data from an Excel file:
 

import com.kms.katalon.core.testdata.ExcelData
import com.kms.katalon.core.testdata.TestDataFactory

4. Define the path to the Excel file containing the data to be loaded:

String excelFilePath = "path/to/excel/file.xlsx"

5. Load the Excel file using the TestDataFactory class:

 

ExcelData data = TestDataFactory.findTestData(excelFilePath)

6. Define the column names in the Excel file that correspond to the data to be loaded:

 

String[] columnNames = ["Column1", "Column2", "Column3"]


 7. Use a loop to iterate through the rows in the Excel file and execute the data loading process for each row:

for (def row : data.getAllData()) {
    String column1Value = row.get(columnNames[0])
    String column2Value = row.get(columnNames[1])
    String column3Value = row.get(columnNames[2])
    
    // Add code here to perform the data loading
}
 

8. Add the necessary code to perform the data loading, based on your specific requirements. This could include database inserts, API calls, or other actions.

9. Save the test case and close it.

10. In the test suite, select the test case and click on the "Data Files" button in the bottom panel.

11. Click on the "Add" button and select the Excel file containing the data to be loaded.

12. In the "Data Binding" section, select the columns from the Excel file that correspond to the variables used in the test case.

13. Save the changes to the test suite.

14. To execute the test case at scale, click on the "Run" button in the top toolbar and select "Data-driven" as the execution mode.

15. In the "Data Binding" section, select the Excel file containing the data to be loaded.

16. Click on the "Run" button to execute the test case for each row in the Excel file.
 

By following these steps, you can use Katalon Studio to automate data loading at scale as part of an RPA solution. 
 

The data-driven testing feature allows you to easily execute the same test case or test suite with different sets of data, without the need to manually modify the test case each time.

 

Data extraction

Data extraction is a common task in RPA and can be easily performed using Katalon Studio. Here are the steps to perform data extraction with Katalon as an RPA process:

1. Create a new test case in Katalon Studio.

2. Import the necessary packages for reading data from a web page:

import org.openqa.selenium.By
import org.openqa.selenium.WebElement
import com.kms.katalon.core.webui.driver.DriverFactory

3. Define the URL of the web page from which you want to extract data:

String url = "https://www.example.com"

4. Open the web page using the WebUI.openBrowser() keyword:

WebUI.openBrowser('')
WebUI.navigateToUrl(url)

5. Use the DriverFactory class to get a reference to the current WebDriver instance:

WebDriver driver = DriverFactory.getWebDriver()

6. Use the findElements() method to locate the HTML elements that contain the data to be extracted:

List<WebElement> elements = driver.findElements(By.xpath("//div[@class='data-container']"))

7. Use a loop to iterate through the elements and extract the data:

for (WebElement element : elements) {
    String data = element.getText()
    
    // Add code here to save or process the extracted data
}

8. Add the necessary code to save or process the extracted data, based on your specific requirements. This could include writing the data to a file or database, or using it to perform further processing.

9. Save the test case and close it.

10. To run the data extraction process as an RPA process, you can create a batch file or shell script that calls the Katalon command-line interface (CLI) and specifies the test case to be executed. For example:

bash
cd /path/to/katalon/studio
katalonc -noSplash -runMode=console -projectPath="/path/to/project" -testSuitePath="Test Suites/Data Extraction" -executionProfile="default" -browserType="Chrome"
 

This command will execute the "Data Extraction" test suite in the specified project, using the default execution profile and the Chrome browser.
 

By following these steps, you can use Katalon Studio to automate data extraction as part of an RPA process. The WebDriver API provides a powerful set of tools for locating and extracting data from web pages, and Katalon's integration with WebDriver makes it easy to use these tools in your RPA workflows.
 

Conclusion

In summary, several use cases can be accomplished with Katalon as an RPA solution. Notably, the synergy of a library of tests can be tapped into for production automation. Equally, various production automation artifacts can be retrofitted for testing purposes, demonstrating the platform's flexibility.
 

A significant advantage lies in the shared skill sets within Katalon. Teams can transition smoothly between tasks, enhancing efficiency. When combined with Katalon's support for automation frameworks, command-line interfaces, and CI/CD tools, it's evident that the platform delivers flexibility catering to a broad spectrum of use cases:
 

  • File manipulation, extraction, and uploading: Katalon can be used to automate file manipulation tasks such as renaming, moving, copying, and deleting files, as well as extracting data from files and uploading them to web applications.
  • API testing: Katalon can be used to automate API testing tasks, including sending GET and POST requests, parsing responses, and verifying API functionality.
  • Data loading: Katalon can automate the process of loading data into a database or other system, including tasks such as data transformation, data validation, and error handling.
  • Data extraction: Katalon can extract data from web pages or other sources, including tasks such as locating HTML elements, parsing text, and saving or processing the extracted data.
     

These tasks can be performed at scale by leveraging Katalon's support for automation frameworks, command-line interfaces, and CI/CD tools. With its powerful features and integrations, Katalon provides a flexible and reliable RPA solution for a wide range of use cases.

 

Start Testing With Katalon