Forum Discussion

PavloRaketa's avatar
PavloRaketa
New Contributor
5 years ago
Solved

How to add some number in data

Hi! I have TestCase, where in one requset i get data (some number), and this data i must insert in another soap request, but with plus(+) one (1). I write ${path to data...+1} but it isn`t work. How ...
  • Lucian's avatar
    5 years ago

    Hi,

     

    Take the following example. I have a request where the response would contain a x = 1:

     

    I am extracting this value into a test case property:

    An then I am sending it as a parameter while also incrementing its value by 1:

     

    Here's how the expression works:

    // this is a way to tell ReadyApi that what will be inside { ... } will be a groovy script
    ${=...} 
    
    // reading the test case property named 'x'
    context.expand('${#TestCase#x}')
    
    // the properties are always strings in ReadyApi, so we need to parse the value to int
    context.expand(...).toInteger()
    
    // and finally increment by 1
    ...+ 1