java - How to test the response content-type using SOAP UI -
i new soap ui . got requirement test if response body not empty .
can please tell me how solve.
my idea check content-length of response using assertion script not working equals().
contains() working not equals:
// works: assert ((com.eviware.soapui.support.types.stringlist)messageexchange.responseheaders["content-length"]).contains("0") // not working: assert ((com.eviware.soapui.support.types.stringlist)messageexchange.responseheaders["content-length"]).equals("0") // not working: assert ((com.eviware.soapui.support.types.stringlist)messageexchange.responseheaders["content-length"]) == 0 please me solve issue.
in code:
// works: assert ((com.eviware.soapui.support.types.stringlist)messageexchange.responseheaders["content-length"]).contains("0") // not working: assert ((com.eviware.soapui.support.types.stringlist)messageexchange.responseheaders["content-length"]).equals("0") // not working: assert ((com.eviware.soapui.support.types.stringlist)messageexchange.responseheaders["content-length"]) == 0 the expression messageexchange.responseheaders["content-length"] returns stringlist[see doc here], arraylist<string>.
it's content several strings, ("abc", "def", "ghi").
contains("0"):
this way, when call list.contains("abc"), asking if "abc" 1 of elements of list. content-length header list 1 element, ("0"). that's why list.contains("0") returns true, because string "0" 1 of elements on list.
equals("0"):
so, when call: list.equals(something), return true if something passed parameter list of strings well. "0" not list of strings, one.
== 0:
same way, when call list == 0 testing if list integer 0, not.
messageexchange.responseheaders["content-length"] == 0 should not work because. messageexchange.responseheaders["content-length"] returns list of strings, different integer number 0.
messageexchange.getresponse().getcontentlength() == 0 works because messageexchange.getresponse().getcontentlength() returns content-length header long integer value.
messageexchange.getresponse().getcontentlength() same getting first value of list , converting long. how work: long.valueof(messageexchange.responseheaders["content-length"].get(0)) == 0.
Comments
Post a Comment