mehdihs
5 years agoNew Contributor
SOAPUI Script Assertion: Identical values failing assert
While trying to test a REST API I am trying to compare a value in a response with a previous value stored in a separate testCase. Using script assertion, I am getting the proper values and they are i...
- 5 years ago
Hi,
richiemakes a good point about potential trailing spaces. Beyond this, are sure they are the same type? For example 12345 is not equal to "12345". You could try casting both values to a string or integer and then comparing. E.g. assertEquals leftSide.toString().trim() == rightSide.toString().trim().
Also, you might want to read further into Groovy/Java string comparators. I quite often use the .equals() and .contains() methods on a string. Example assert leftSide.toString().equals(rightSide.toString()) or assert leftSide.toString().contains(rightSide.toString())