cancel
Showing results for 
Search instead for 
Did you mean: 

How to declare variable with project property value as public?

SOLVED
Highlighted
Frequent 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

1 ACCEPTED SOLUTION

Accepted Solutions
Community Hero

Re: How to declare variable with project property value as public?

Can you not use as below:

 

def fileName = 'C:/temp/myfile-'+new Date().format('yyyy-MM-dd-HH-mm-ss')+'.txt'
log.info fileName


Regards,
Rao.

View solution in original post

2 REPLIES 2
Community Hero

Re: How to declare variable with project property value as public?

Can you not use as below:

 

def fileName = 'C:/temp/myfile-'+new Date().format('yyyy-MM-dd-HH-mm-ss')+'.txt'
log.info fileName


Regards,
Rao.

View solution in original post

Frequent Contributor

Re: How to declare variable with project property value as public?

Simple and nice solution.

Thank you Rao

New Here?
Join us and watch the welcome video:
Watch the new Interview
Top Kudoed Authors