How to store url obtained through "current url = WebUI.getUrl() " in test data(in Data files)

Please tell me how to store url obtained through "current url = WebUI.getUrl() " in test data(in Data files).

After acquiring the current URL by the following method, I want to contain it in the “url” row in the test data (excel).

image

If anyone knows how to store variable in test data(in Data files), please help.

No, it is not possible. Katalon’s “Test Data” is a concept that provides Read-only access. You can not update “Test Data” at all.

You should consider other storage for your data: GlobalVariable, Files on disk (plain text, text in CSV, text in JSON, *.xlsx Excel)

If you create a spreadsheet within the Data folder with a given name, then you can write and read your URL to and from it. I show an example in the question below:

Can you tell me how to save that?

No. As I told you, you can not save it into the “Test Data” as it is READ-only.

If you want write a data into file read it again, in Groovy, it’s so easy:

I wanna do like this…


get URL then put into the excel file…
It seems like Enterprise license should be required…

Enterprise license is not required to do what the video teaches you.

The video is instructing you how to write a Groovy script that uses the Apache POI library. The POI enables Java/Groovy script to read/write Excel files (*.xlsx). The library is an open-source, free of charge. The POI library is bundled in Katalon Studio free version as well. So you can just learn the video. Then you should be able to do what you wanted.

There is a Katalon Studio plugin “Excel Keyword”

This is a thin wrapper that encloses and drives the Apache POI. It provides a bit simplified API than the POI native API. You may find the plugin is easier to learn than the POI itself.

It is up to you which one you take: POI or the plugin

I tried to plug-in… like this

Now what can i do from this ?
I just wanna download url to excel…

@duyluong
@Shin
@Jass

He is lost where to go next after installing the Excel Keywords plugin.

People need better documentation of this plugin.

The page https://store.katalon.com/product/34/Excel-Keywords describes only how to install. It tells no description how to write an Excel file, how to read an Excel file. Poor document!

1 Like

lol. That’s why i am struggling now… i just want to read and write an Excel file…

@hojun.lee

I do not recommend you to try saving data into Excel.

You should find alternative way. You should not stick to writing data into Excel in Katalon Studio.
You should rather save the urls in a plain text file, line by line.
You may want it in CSV or JSON format. It’s OK, easy enough.
You would find it is enough to save the URL data into a GlobalVariable to pass it around from TestCase to another TestCase. It is far easier.


I guess, you think “Excel is the easiest software to use in the world. I want everything stored int .xlsx files. This would solve all of my problems”. Well, you are tricked by Microsoft. Excel itself is excellent. But the Excel API, with which external software like POI and Katalon Studio work, is too complex for those without seasoned programming skill. Programming beginners will have a hard time reading / writing any single data into Excel file from Katalon Studio.

In the above post, I mentioned “Excel Keyword” plugin to you. Sorry. To be honest, I have never used it.

Now I looked at it, and found its sole purpose is provide “Keywords” that enables you to indirectly call POI API from the Manual mode of Test Case editor. If you can code scripts in the Script mode, you do not really need the plugin.

The plugin assumes that users do understand the conceptual data model behind the Excel API. The plugin requires users to have similar level of programming skill as the Apache POI.

I wonder who can really make use of this plugin.

  1. The plugin is meant to help the Manual mode users.
  2. The Manual mode users are, usually, not skilled enough for programming.
  3. The plugin assumes users to have good enough programming skill, so that they understand the conceptual data model of the POI API + Excel API.

To me, these 3 statements do not hold true together.

Just for your interest

csv files are also available…

https://www.baeldung.com/groovy-io

@kazurayam
You misunderstand my point.
I told you that I preserve it as an Excel file, but it doesn’t really matter to me whether the file name is csv or xlsx.

If you know the process of storing URL data in GlobalVariable and delivering it from TestCase to another TestCase, please let us know easily. I’m already used to the csv file because I’m already using tools such as Python, sql, and R…

1, in the “default” Execution profile, create a GlobalVariable named “url”
2. create a Test Case “TC1” that opens browser and navigate to a url http://demoaut.katalon.com. It gets the URL string and set it into the GlobalVariable.url
3. create a Test Case “TC2” that reads the GlobalVariable.url, and print it into the log
4. create a Test Suite “TS1” that binds TC1 and TC2
5. execute TS1
6. in the log, you will find a message “url is https://katalon-demo-cura.herokuapp.com

I tried to make TC1. But it doesnn’t RUN(errors)…
And What’s the code for TC2?. Let me share

You typed

htpp://demoaut.katalon.com

It should rather be:

http://demoaut.katalon.com

TC2 is:

import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

import internal.GlobalVariable as GlobalVariable

WebUI.comment("url is " + GlobalVariable.url)