_ivanovich_
7 years agoFrequent Contributor
How to declare variable with project property value as public?
Hi,
i have a project property like:
property name: ftime
value: ${=def now = new Date();now.format("yyyy-MM-dd-HH-mm-ss")}
i would llike to append ftime in a filename.
so if i get the property inside my try catch block it works.
If it's outside it doesn't.
so how should we declare the variable.
i tried with static
static def ftime = testRunner.testCase.testSuite.project.getPropertyValue("ftime")
try{
def fileName = 'C:\\temp\\myfile-'+ftimeime+'.txt'
}catch
(Exception e){
log.info "Error"+e
}
Thank you
Can you not use as below:
def fileName = 'C:/temp/myfile-'+new Date().format('yyyy-MM-dd-HH-mm-ss')+'.txt' log.info fileName