Forum Discussion

sparrowenclave's avatar
sparrowenclave
Occasional Contributor
4 years ago
Solved

How to get Integer value from excel and store in Soap UI properties step

 

I have one data in excel which holds numeric value and when I am sending the same value from Excel to Soap UI properties, it's value getting converted into string like below:

In Excel: Value of Data column is 200 In Soap UI properties: Value of Data field is getting changed to 200.0

Can anyone help me to get the same numeric value in Soap UI properties?

 

 

  • Hey!! Thanks for mentioning richie , yes you are absolutely correct.

     

    This is happening because Properties Step stores values in (key : value) pairs which are (String : String) if you want to use it as Integer than you need to parse it into integer.

     

3 Replies

  • richie's avatar
    richie
    Community Hero
    Hey sparrowenclave,

    Are you saying youve already extracted the value and stored as a property already? As youve noticed poperties are stored as strings by default. Im typing this out on my phone (not sitting in front of laptop and so going on memory), but if you have the property stored at testcase level you can try the following:

    // grab property from testcase level
    def propStringValue = testRunner.testCase.getPropertyValue("propertyName")
    //cast the string to integer type
    def propStringValue = propStringValue.toInteger()

    The above code will cast the string to integer type if property stored at testcase level. Youd need to edit if its stored elsewhere.

    I need to highlight that HimanshuTayal gets the credit for this....i just ripped this from one of his answers!

    Nice one,

    Rich