开发者

SOAPUI: Apply assertions to all requests?

开发者 https://www.devze.com 2023-02-28 04:15 出处:网络
What is the cleanest, most elegant way to apply the same assertion to all SOAP Requests? I\'m creating a test that pings multiple services (24 or so) and validates they contain (or don\'t contain) th

What is the cleanest, most elegant way to apply the same assertion to all SOAP Requests?

I'm creating a test that pings multiple services (24 or so) and validates they contain (or don't contain) the same element of a response. (For example, all servi开发者_StackOverflow社区ces accept a valid SAML token).

One solution:

 - create a global/project property named "assertion1" with value "invalid token"
 - under each soap request, add a "does not contain" assertion with the value "${assertion1}"
  • Benefit: only have one location to update the string value
  • Drawbacks: If I want to add/remove an assertion, I must do so for each service


My 2 cents

Other way could be have a groovy script at the end of 24 or so requests and get the element from each request and assert for the SAML token.

Your idea of using "does not contain" is not a strong way to test the element.

Hope this helps


As mentioned by SuperMan groovy script is the good idea to do the assertion. And you will be able to add any type of assertion. For example if it is an xpath assertion, it will require two inputs xpath and expected content as arguments unlike one argument in case of contains.

Also instead of doing assertion after all the steps, you will be able to do it after test step event. If you are a soapui pro user, you may use the events for this. SoapUI free edition does not have this feature, however you can use soapuiExtensions library to achieve after step event.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号