I want to use a macro in multiple test suites. In some test suites I use a global variable and in others I don’t. So in some test suites the variable will be ‘not defined’. Is there a way to check if the global variable is set?
You could have a macro that does nothing else then setting all used global variables to “0”, so that they are defined.
store 0 globalVarA
store 0 globalVarB
store 0 globalVarC...
and then use this macro that the top of every test suite. Will this solve the issue?
Interesting idea, thank you. I’ll try to do it like this.
I know this is an old post, but maybe somebody will find it useful.
A good way to check whether a variable is defined or not is to test it in an “if” and catch the error if it’s undefined.
For example:
onError | #goto | VarUndefined
if | #{globalMyVariable}
gotoLabel | MyVariableAlreadyDefined
end
label | VarUndefined
---- do whatever you want to do if the variable is not defined —
label | MyVariableAlreadyDefined
---- do whatever you want to do if the variable is already defined ----