How to retrieve data or no. id from previous step when using katalon studio for testing

HI,

How to get or retrieve data from previous step when do testing? How to not duplicate new data when do repetition of testing

1 Like

Use “GlobalVariable”. See the following doc.

Though I am afraid that this doc page would be difficult for you to understand.

Let me give you an example.

In the Execution Profile “default”, I made a Global Variable named FAVORITE_THING with a string value.

I made a series of Test Cases: TCa, TCb, TCc, TCd

スクリーンショット 2024-03-01 16.36.24

Each scripts manipulates the GlobalVariable.FAVORITE_THING.

Test Cases/TCa:

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

import internal.GlobalVariable as GlobalVariable

WebUI.comment(">>>" + GlobalVariable.FAVORITE_THING)

GlobalVariable.FAVORITE_THING = "Bright copper kettles and warm woolen mittens"

Please find how this script reads the value of GlobalVariable.FAVORITE_THING, and how it updates it.

Test Cases/TCb:

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

import internal.GlobalVariable as GlobalVariable

WebUI.comment(">>>" + GlobalVariable.FAVORITE_THING)

GlobalVariable.FAVORITE_THING = "Brown paper packages tied up with strings"

Please find that the TCb can refer to the value set by the TCa.

Test Cases/TCc:

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

import internal.GlobalVariable as GlobalVariable

WebUI.comment(">>>" + GlobalVariable.FAVORITE_THING)

GlobalVariable.FAVORITE_THING = "These are a few of my favorite things"

Test Cases/TCd:

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

import internal.GlobalVariable as GlobalVariable

WebUI.comment(">>>" + GlobalVariable.FAVORITE_THING)

I created “Test Suites/TS1”:

When I ran the TS1, I got the following output:

Is this what you wanted?

Thanks for the answer.

But my situation is using katalon, when I record the test and will be create new id. so after we want to check pass or not, we need to run the record. so after we run the record it will be create another new id

So, how to not create another id when rerun the record of step/testing?

I do not see what you mean by the word id. Please clarify what the id you mean. Any screenshot?

i mean no. of registration

i have problem with,

when do the testing we need to generate new no of registration. then after we re run the recording or playback, katalon generate another new no of registration

so how to solve?

What do you mean the word “registration”?

Maybe write out your registration id to a spreadsheet between test runs and then read the registration id back in from that spreadsheet.

can I know how the step when write out registration id to a spreadsheet

mean that number of the case

number of registration = number of case that will be registered

for example : 50550 (number id for case will be registered)

Click on the link (the blue text) in my post above and then click on the black arrow with the text, “Maybe like this:” and the sample text about writing to a spreadsheet will display. Review it and see if it will work for you.

Alright thanks a lot