Forum Discussion

rlong98's avatar
rlong98
Contributor
10 years ago
Solved

How can I add to a number in project properties through context?

If I have a number in Project Customer Properties

 

${#Project#fpl_us48_single}

Which will pull the value of 11770

 

I want to add to this federal baseline number to meet different scearios (thus if the Federal # changes I don't have to change anything but the one property value)

 

So how could I +1 to this context?

 

Thank you,

Rob

  • nmrao's avatar
    nmrao
    Icon for Champion Level 2 rankChampion Level 2

    I believe you are reading it groovy and do an increment?

    then as shown below

     

    def projPropertyValue = context.testCase.testSuite.project.getPropertyValue('fpl_us48_single') as integer

    Then you  will be able to do all math operations such add, subtract

     

    While storing back to property, write it as String

     

    context.testCase.testSuite.project.setPropertyValue('fpl_us48_single', projPropertyValue as String)