Search code examples
testingsoapuiassertionsweb-api-testing

Adding an assertion to ALL SoapUI test cases


We have a somewhat large project with a series of tests against endpoints. Due to the way the configuration for this API works, there's occasionally a chance that a field in any given response could be missing, replaced with the string "[invalid field]". Obviously when this happens, something is broken and we need to fix it, so I want to check for this string in all responses.

Is there a way to check all responses for this, or should I just put an assertion into each test manually?


Solution

    1. Create one assertion via SOAPUI.
    2. Go to the project's XML file and find </con:request>. Right after it there is a <con:assertion>...</con:assertion> element.
    3. Find and replace all </con:request> with <con:assertion>...</con:assertion>
    4. Assertion magic all over the place.