Forum Discussion

avidCoder's avatar
avidCoder
Super Contributor
7 years ago

How to get all the propertyValues using code?

I am trying to fetch all the propertyValues together.. To fetch the propertyNames, I have tried this code and it works:-

 

import groovy.json.*

def prop = context.testCase.getTestStepByName("Properties");
propToGet = prop.getPropertyNames();

 

log.info propToGet

 

Similarly, I want to fetch the values also.

  • What is your use case?

     

    How about the below?

    def step = context.testCase.getTestStepByName("Properties")
    step.propertyNames.collect { log.info step.getPropertyValue(it)}
    
  • nmrao's avatar
    nmrao
    Champion Level 3

    What is your use case?

     

    How about the below?

    def step = context.testCase.getTestStepByName("Properties")
    step.propertyNames.collect { log.info step.getPropertyValue(it)}