Search code examples
soapuiassert

SOAPUI - Assert error thrown even condition is true


I'm getting assert error even though the condition is true as shown below:-

enter image description here

Anything missing here?


Solution

  • The problem are that object types are different.

    jdbcCount internally is a String however dataSourceCount is an Integer. This is why you see in the log the same value however assert fails.

    Try using toString() to convert dataSourceCount to String and to pass the assert correctly:

    assert jdbcCount == dataSourceCount.toString()

    Or alternatively as @Ramu suggest on the comment due the values are numbers rather than compare strings, compare integers passing jdbcCount to int:

    assert Integer.parseInt(jdbcCount) == dataSourceCount

    Hope this helps,