Forum Discussion

krogold's avatar
krogold
Regular Contributor
6 years ago

Is it possible to set properties of a runTestStepByName target ?

Hello,   I have several steps with 'input' custom properties that I wish to call for several items. I parse the item list in a groovy step, then call the steps using the runTestStepByName metho...
  • HimanshuTayal's avatar
    6 years ago

    Hi krogold ,

     

    Ok, i think i read it correctly, that you want to set a custom property at run time at a step that is groovy step,

     

    so it's not possible to do so. If you want to achieve than store the value in context variable and use it in your groovy step

     

    device_list.each{
    	device ->
    
    	// check external id
    	step = testRunner.testCase.getTestStepByName("check externalId")
    	//step.setPropertyValue("uid", device) don't use as there is no custom property at groovy step
    context.setProperty("uid", device) testRunner.runTestStepByName("check externalId") }

    and in calling groovy step use below to fetch value from context variable

     

    log.info context.uid

    Hope this will help, if you find any issue please let me know.