Forum Discussion

Slimy37's avatar
Slimy37
Occasional Contributor
14 years ago

putting variables back into properties

I have found the following code that uses a value from a Property and processes it, with the intention of putting it back into the same property. I feel like I'm missing something obvious here, but I just can't figure out how to put it back into the property;

temp = context.expand( '${Properties#viewstate1}' );
temp = temp.replaceAll("\\+","%2B");
temp = temp.replaceAll("\\/","%2F");

How do I put temp back into Properties#viewstate1?
  • deepesh_jain's avatar
    deepesh_jain
    Frequent Contributor
    Hi,

    Try the following:

    ts = testRunner.testCase.getTestStepByName( <property_step_name> );
    ts.getProperty(<property_name>).setValue(temp);

    Let me know if this helps.

    Thanks,
    Deepesh
  • Slimy37's avatar
    Slimy37
    Occasional Contributor
    Deepesh you are a star! That works absolutely perfectly, thank you.