cancel
Showing results for 
Search instead for 
Did you mean: 

SoapUI (Pro) > DataDriven > Message Content Assertion - How to handle decimal values

Frequent Visitor

SoapUI (Pro) > DataDriven > Message Content Assertion - How to handle decimal values

I am using ReadyAPI(SoapUI Pro) for testing of a RestAPI. For TestData I'm using DataSource (DataDriven), where i am giving the Inputs (API Input) from excel. And to test the API response i am comparing the Output from Excel (Expected results are already in excel).
For that I am using Message Content Assertion (as its easy and im not much technical). Now problem is, In excel Expected Output is say 10.0 but when i use this excel field for assertion in SoapUI (Pro) it reads 10.0 > 10. But from API Response value is 10.0. So Assertion failed. I tried to handle it in excel but no luck.
 

So need help. In SoapUI we can handle it? (so that API response(10.0) match with Assertion value 10)

 

If its not possible using Message Content Assertion, then is it possible with JSONPath Existence Match ( I have not much knowledge of Json)

1 REPLY
Frequent Contributor

Re: SoapUI (Pro) > DataDriven > Message Content Assertion - How to handle decimal values

Format cell and take data as text like this - '176.98 and then call it. Else try this code:-

def data = 176.98
log.info new Double(data).round(2)
assert new Double(result).round(2)==176.98 

Hope it works for you.

Share Your Stories
Read Latest News
Top Kudoed Authors