Using a runtime value from one TC to another


I want to re-use a runtime value in TC2 that is being generated in TC1.
I tried to save the value as a Global varibale but no success.
Below are the part of scripts used -
From TC1, to save the runtime value
String fieldValue = WebUI.getAttribute(findTestObject(‘Object’s path’),
GlobalVariable.ResourceVaribale = ‘fieldvalue’

Reusing the varibale in TC2 -
def myVariable = GlobalVariable.ResourceVariable

Can someone have a look and help!

Thanks in advance!


You have this:

You should strip the pair of single quotes and corrent the variables name, as:

GlobalVariable.ResourceVariable = fieldValue

You typed a string “varibale” which is wrong spelling. You should type “variable” instead.

1 Like