Forum Discussion

rdebie's avatar
rdebie
Contributor
17 years ago

Remove property from Properties step

How can i remove a property from the properties step.

I thought by using the lines below:

def targetStep = testRunner.testCase.getTestStepByName( "Properties" );
if ( targetStep.getProperty( PropName ) != null )
      targetStep.deleteProperty( PropName );

But when i look in the properties step the property is still there.

What do i wrong??

regards
Raymond[flash=200,200:37d38q6f]http://[flash=200,200][/flash:37d38q6f][/flash]

4 Replies

  • To remove all properties from the Properties step in a test case:

     

     

    def targetStep = testRunner.testCase.getTestStepByName("Properties");
    
    for(prop in targetStep.getProperties()){
         targetStep.removeProperty(prop.getKey());
    }

     

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Raymond,

    you should use the removeProperty method instead.. ie

    def targetStep = testRunner.testCase.getTestStepByName( "Properties" );
    if ( targetStep.getProperty( PropName ) != null )
          targetStep.removeProperty( PropName );

    Hope this helps!

    /Ole
    eviware.com