BlackGaff
BlackGaff

Reputation: 7707

SOAPUI: Apply assertions to all requests?

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 services 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}"

Upvotes: 2

Views: 2736

Answers (2)

Rao
Rao

Reputation: 21389

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.

Upvotes: 2

SuperMan
SuperMan

Reputation: 3584

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

Upvotes: 3

Related Questions