cancel
Showing results for 
Search instead for 
Did you mean: 

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

SOLVED
Highlighted
Occasional Contributor

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?

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Leader

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

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.

 


Click "Accept as Solution" if my answer has helped, and remember to give "kudos" 🙂 ↓↓↓↓↓



Thanks and Regards,
Himanshu Tayal

View solution in original post

3 REPLIES 3
Highlighted
Community Hero

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

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
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
Highlighted
Community Leader

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

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.

 


Click "Accept as Solution" if my answer has helped, and remember to give "kudos" 🙂 ↓↓↓↓↓



Thanks and Regards,
Himanshu Tayal

View solution in original post

Highlighted
Occasional Contributor

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

Hi @HimanshuTayal @richie 

 

 Agreed with your approach, but I found another way to achieve this by using DataFormatter class to get the cell content exactly present in the formatted cell and it always return a strings.

 

Please check the below link for more details

https://poi.apache.org/apidocs/dev/org/apache/poi/ss/usermodel/DataFormatter.html#formatCellValue-or...

 

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors