cancel
Showing results for 
Search instead for 
Did you mean: 

Access custom properties programmatically ?

SOLVED
rajs2020
Frequent Contributor

Access custom properties programmatically ?

Test cases have custom properties. To access each property inside a groovy script, I have to repeat the this "context.expand( '${TestCase#SomeProperty}" for each property. Is there a shorter way to access such properties? Perhaps like this:

def allProps = context.expand('Get all the properties')

def name = allProps.get('Name')

1 ACCEPTED SOLUTION

Accepted Solutions
aaronpliu
Frequent Contributor

Re: Access custom properties programmatically ?

Hi @rajs2020 ,

 

FYI.

 

testRunner.testCase.propertyList.each {
    log.info "name=${it.name}, value=${it.value}"
}

 

Thanks,

/Aaron

View solution in original post

2 REPLIES 2
nmrao
Community Hero

Re: Access custom properties programmatically ?

Even the sample you posted is doing the same. Isn't it?
For each property, you are calling get method to get the value.


Regards,
Rao.
aaronpliu
Frequent Contributor

Re: Access custom properties programmatically ?

Hi @rajs2020 ,

 

FYI.

 

testRunner.testCase.propertyList.each {
    log.info "name=${it.name}, value=${it.value}"
}

 

Thanks,

/Aaron

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors