I’m new to Katalon. I’ve recorded a test case, and I am editing it to make it easier to use to test multiple environments. I have created a profile for one of the environments to test against, and created global variables for the test case to use. For simple variables, like a user’s first name, I created a string variable, and that’s easy to select for input in the test case.
I also created a mapped object called taxable address that represents a shipping address (i.e. street, state, zipcode, etc.) But for the global mapped variable, I can’t select any of the mapped properties - only the object name (taxable address) itself.
I have searched for a while but can’t find a example of using global mapped variables in a test case. How do I reference the mapped properties in the test case UI input?
Hi Brian, I have the exact same question. Did you ever find a solution?
It’s a shame no one jumped in to help @brian.leone with his original problem. Brian, if you’re still around, we’re not normally so neglectful
Okay, what we have here is a Map called
GlobalVariable which contains a Map called
This code will retrieve the
TaxAddress map from the GlobalVariable map so that it can be handled separately:
Map taxaddress = GlobalVariable.TaxAddress
If you’re feeling ultra-pedantic:
Map taxaddress = (Map) GlobalVariable.TaxAddress
Once you have
taxaddress, then you can access the members like so:
Hi Russ! Ok, thank you I will give that a try!
That worked perfect for me. I also saw that instead of mapping to a local variable I could access the GlobalVariable object :
Yep, that’s fine too. There are purists (the syntax police) that will insist that one way is better than another but once you’ve found a pattern that works, my advice is stick to it. If it causes an issue later, find a better one.
This is test code. Be pragmatic.