GMSoapUI
12 years agoContributor
[Res]Accessing project variable from TestS..Listner.afterRun
Hello,
In a Groovy script I have created a project level variable. I am then trying to access this variable from within a TestSuiteRunListner.afterRun event listener. It works in all the other listeners I'm using but does not work in this particular one and I'm baffled as to why.
Here is an abstract of the listener code:
Could somone advise what is awry with the code or how I might access the variable from within this particular listener? As I mentioned this code works within the two other listeners I have, namely:
TestRunListener.afterStep
TestSuiteRunListener.beforeTestCase
Is this a context issue perhaps?
I have tried:
and
But nothing will let me access the variable's value.
The error I get is:
In a Groovy script I have created a project level variable. I am then trying to access this variable from within a TestSuiteRunListner.afterRun event listener. It works in all the other listeners I'm using but does not work in this particular one and I'm baffled as to why.
Here is an abstract of the listener code:
def vntProject = testCase.testSuite.project;
...
log.info( "MESSAGE: " + vntProject.getPropertyValue( "myProjectLevelVariable" ) );
Could somone advise what is awry with the code or how I might access the variable from within this particular listener? As I mentioned this code works within the two other listeners I have, namely:
TestRunListener.afterStep
TestSuiteRunListener.beforeTestCase
Is this a context issue perhaps?
I have tried:
def vntProject = testRunner.testCase.testSuite.project;
and
def vntProject = testSuite.project;
But nothing will let me access the variable's value.
The error I get is:
Thu Jan 30 15:35:02 GMT 2014:ERROR:groovy.lang.MissingPropertyException: No such property: testCase for class: Script20