How To Shorten the Length of a String Parameter
- 3 years ago
hello juliobello
richie pointed you in a good direction. You can actually put full groovy script into the ${= } syntax...
Here is some groovy code that would work if it was in a groovy test step:
def tmpUUID = java.util.UUID.randomUUID().toString(); tmpUUID = tmpUUID.replaceAll("-", ""); return tmpUUID;
You can compress that and use it in place of your current dynamic property...
Instead of:
${=java.util.UUID.randomUUID()}
Try:
${=def tmpUUID=java.util.UUID.randomUUID().toString();tmpUUID=tmpUUID.replaceAll("-", "")}
Regards,
Todd
- 3 years ago
Hi, Richie...
There is nothing "sacred" about the parameter format, other than the fact that it must be 35 characters or less. It does not have to be a UUID. It was the first "random string generator" I found. A timestamp in milliseconds will suffice.
I am new to this "groovy" scripting language. I am interested in knowing for my edification how to "substring" a string.
Where is the complete "groovy" scripting language library specification?
Thank-you!
- 3 years ago
Hi, Todd...
I did not know that one can actually put full groovy script into the ${= } syntax.
I already accepted Richie's response as a solution. I don't know if I can also "accept" your solution.
I am new to this "groovy" scripting language. For my edification, I am interested in knowing how to "substring" a string.
Where is the complete "groovy" scripting language library specification?
Thank-you for your response.
- 3 years agoHey juliobello,
For future reference if TNeuschwanger or nmrao or ChrisAdams or KarelHusa suggests stuff, id always go with their approaches rather mine cos my groovy skills bite.....the only reason i know any groovy is cos the above lads taught me!
I've switched the Accepted Solution from mine to Todd's as this is the better "fix" in this case (and Todd's actually taught me something new, so nice one for that!)
Cheers,
Rich