Forum Discussion

PhillipB's avatar
PhillipB
Occasional Contributor
8 years ago

Accessing property in TestStep?

Hi,

 

I'm trying to learn how to use Property.  So I create test step property by going to "Case" menu then select "Add Step" then choose "Properties".  So my property name is "myTestStepProperty".

 

 

In my "Hello" test step script, I have the following:

 

//get property test step
def testStepProperty1 = testRunner.testCase.getTestStepByName('Hello').getPropertyValue('myTestStepProperty')
log.info " testStepProperty1= " + testStepProperty1


//set property test step
testRunner.testCase.getTestStepByName('Hello').setPropertyValue('myFirstTestStepProperty', '12345')

//get property test step def testStepProperty2 = testRunner.testCase.getTestStepByName('Hello').getPropertyValue('myFirstTestStepProperty') log.info " testStepProperty2= " + testStepProperty2

But the log shows null of the properties.  Am I doing something wrong?  Thanks.

  • I found the solution now.

     

    def propTestStep2 = testRunner.testCase.getTestStepByName("myTestStepProperty").getPropertyValue("myFirstTestStepProperty")
    log.info " propTestStep2= " + propTestStep2
  • PhillipB's avatar
    PhillipB
    Occasional Contributor

    I found the solution now.

     

    def propTestStep2 = testRunner.testCase.getTestStepByName("myTestStepProperty").getPropertyValue("myFirstTestStepProperty")
    log.info " propTestStep2= " + propTestStep2