Ask a Question

Accessing property in TestStep?

SOLVED
PhillipB
Occasional Contributor

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".

 

AccessingTestStepProperty.jpg

 

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.

1 REPLY 1
PhillipB
Occasional Contributor

I found the solution now.

 

def propTestStep2 = testRunner.testCase.getTestStepByName("myTestStepProperty").getPropertyValue("myFirstTestStepProperty")
log.info " propTestStep2= " + propTestStep2
cancel
Showing results for 
Search instead for 
Did you mean: