A Var into a URL

Hey,

I hope I can explain it correctly. So I want to set a variable in a URL like “www.google.com/OID” and a list of variables in a csv for OID. Currently I have the list in a CSV file, I implemented the GET request and set the variable. The console shows me that Katalon iterates through the file and the variable changes.

[INFO] - Variable ‘OID’ is set to 123

[INFO] - Variable ‘OID’ is set to 456

[INFO] - Variable ‘OID’ is set to 789

So far, so good. But how do I write the URL correctly to use the variable in the URL?

I tryed something like www.google.com/{{OID}} does´t work.

www.google.de is just a example!

best regards

Kai

Hi Kai,

can you share a code you use for getting values from CSV?

1 Like

try following:

www.google.com/${OID}
response = WS.sendRequest(findTestObject('path/to/requestObject',[('OID'): OID]))

probably i’m wrong on this…

@Marek Melocik - i thing he is using standard capability of test suite - repeat/cycle based on datasource

1 Like

@Marek Melocik

@Andrej Podhajský

yes, Im using the standard “tool” to implement the data

@Andrej Podhajský

i tryed this already and i lookedup into Wireshark but what I get is a www.google.com/${OID}. The OID is set but in the URL not replaced.

also I added in the Test Suits the Test Data and the Variable Binding

if you need more informations let me know.

2018-08-16_10h07_38.png

2018-08-16_10h07_47.png

2018-08-16_10h08_03.png

2018-08-16_10h10_31.png

com.kms.katalon.core.testobject.RequestObject ro = findTestObject(‘Object Repository/yourRestDefinition’)

ro.setRestUrl(“whatever you want”)

basicaly you can build your own object from scratch … just check api for RequestObject

1 Like