How to update GlobalVariable permanently

@Marek_Melocik thanks bro, this keyword fit perfectly what I was needing

I just wanted to increase a number inside my GlobalVariable Email and It’s working and increasing perfectly well

This is my Code
@TearDown(skipped = false) // Please change skipped to be false to activate this method.
def tearDown() {
	String number = GlobalVariable.RealtorEmail.split('realtor')[1].substring(0,2).trim()
	Integer numberInt = Integer.parseInt(number)+1
	String newEmail1= "lemonbrewqa+realtor" + numberInt.toString() + "@gmail.com";
	
	'Assign new value in real time (not updates the profile)'
	//GlobalVariable.RealtorEmail=newEmail1
	
	'Assign new value in real time (updates the profile with new value)'
	CustomKeywords.'lemonbrew.GlobalVariableUpdater.updatePermanently'("Agent", "RealtorEmail" , newEmail1)
}

@mtayahi I saw the following maybe could helps you, as commented by @Marek_Melocik is that Katalon does not look for updates in the execution profile until the executions are finished. For me it is not a problem because I configured this code in TearDown and it works. But if you are trying to update the same variable, check the commented line in my code. Maybe you can increase this value in every testcase and at the end of the suit you Update the variable value in your profile

To take in mind and was freaking me out was that the profile wasn’t updating automatically in the IDE (but is updating in the folder file). To see that the value increased, you have to close the profile tab and open it again after Katalon finishes loading and sending the reports

PD: This was my first keyword and I didn’t realize that the word “@Keyword” was missing over the public static void functions, so for those whose are in the same take a look on that guys :slight_smile:

1 Like