Quantcast
Channel: New board topics in SmartBear Community
Viewing all articles
Browse latest Browse all 21061

Datsource parametrization from groovy

$
0
0

I have 20 properties that is coming in from excel sheet to data source.Current code (below )is repeated 20 times.I am looking to parametrize the data source property name and value to be set in property.

 

Unparametrized

def pClient = context.expand( '${DS-Master-Excel#pClient}' ).trim()
log.info "pClient is " + pClient
if((pClient != "") & (tr.hasProperty("pClient") )) 
{tr.setPropertyValue("clientAppName".trim(), pClient)}
else {log.info "clientAppName is empt

I tried...a method as below.

SetPropertyMthd('clientAppName','pClient')      
def SetPropertyMthd( String PropName, String PropVal){
   def myvar= context.expand('${DS-Master-Excel#+"${PropVal}"+}').trim()
   log.info "${PropVal}"
   log.info myvar
   log.info "${PropName} ${PropVal}"
}

What happens is log.info "${PropVal}" prints the right value but when used in context.expand (line number 3),it does not seem to work.i tried "",' ' .nothing worked..Has anyone tried it thyis way before.If so, please let me know what needs to be rectified in above code.


Viewing all articles
Browse latest Browse all 21061

Trending Articles