I have 2 testcases
One testcase- open browser and fetch values in string array and need to store that array as global variable
second Testcase-Open another browser and take each of the global array value and search the result for that.
Pls let me know how to acheive this
In Profile,there is list .But don’t know how to initialize array size and use it in code
you may read here:
on short … groovy list should work fine for your case. simply don’t set the size of it
you can iterate over a list very easy:
Thank you for the reply.
I gone through the link mentioned.Still I am unable to code.
Can you pls give sample code.
1.By declaring Global variable as List in Katalon
2.Storing the values in list
3.Retrieving the value from the list by indexing
creating a GlobalVariable is done within KS:
there are several ways to store values in list, but simpliest from bionel’s working-with-collections website, either:
GlobalVariable.gStageList = [‘peter’, ‘paul’, ‘mary’, ‘charlie’]
retrieving value from the list. first item in list is position zero, second item is position one, etc.
WebUI.verifyMatch(WebUI.getAttribute(findTestObject(‘myPage/characterName’, ‘value’), ‘mary’, false))
Thank you so much.
I am getting the value from the CSV file and storing it in string ScBID
then adding that in the globalvaraiable which is declared as ScheduledBID in katalon profile
String ScBID= AllValues.get(i)
I am getting the error as “java.lang.NullPointerException: Cannot invoke method add() on null object”
Attached the screenshot of global varaible declaration.
Pls help me.
Will make some sample codes… Perhaps next week… Or when my time afford it
In the mean time feel free to explore katalon docs and groovy docs, i bet you can find a lot of usefull info there
I have never created a List as a GlobalVariable. Perhaps you need to initialize it first before using it?
GlobalVariable.ScheduledBID = ;
This means that the executed testcase script could not find the GlobalVariable
ScheduledBID at all.
How many Execution Profiles do you have? Do you have any Execution Profile other than
In which Execution Profile did you add the Global Variable
default or something else?
As you know, you are supposed to specify which Execution Profile to apply to a Test Case when you execute it.
Which Execution Profile did you apply?
It worked by changing the execution profile