Forum Discussion

NadiaRanalli's avatar
New Contributor
3 years ago

Check assertion for all test steps



wondering if it is possible to run a test case to check assertions for all test steps performed before, instead of adding the same assertion to all test steps. See below, I would need to add the same assertion for all those test steps:


The assertion would be to check that each response contains the same data below in bold:


<soapenv:Envelope xmlns:soapenv="" xmlns:xsd="" xmlns:xsi="">
<InterConnectResponse xmlns="">



Thanks a lot!

3 Replies

  • ChrisAdams's avatar
    Champion Level 3



    In this case and based on the following assumptions from your question...

    • The assertion is the same for every step
    • Each step is within a single test case
    • I do not want to update each step to add the same assertion and that would be a pain.

    I would add a single groovy script as the last step in the test case.  The Groovy script would iterate over each test step and then check the values of interest.


    Luckily, some SmartBear people and contributors have been writing some guides.

    There is one you might find especially useful...  This at least will guide in you in how to iterate over the test steps, but it mentions assertion status, which you won't have because you have not applied to the assertion to each.


    Another approach... It looks like you're calling the same service lots of times with different payloads.  You might want to look up data-driven tests whereby for each row in some datasource, you call the same service in a loop but the values change for each row.  If that's the case, then you only need one webservice call and therefore, only one assertion to apply.

    • NadiaRanalli's avatar
      New Contributor

      Hi Chris,


      Thanks a lot for your response but I would really appreciate if you could help me to write the actual script as I am not a dev and I wouldn't be able.

      Here the info:

      SOAPUI project: STS_CompanyRetrieval

      SOAPUI TestSuite: Request_ErrorManagement


      Thanks a lot!


      • ChrisAdams's avatar
        Champion Level 3



        I'm happy to help, but not to build your solution from scratch.  Take a look at the guides and have a go then post what you've come up with and there are plenty of people who can help.


        What ever I/we provide is not likely to be perfect as we don't have access to the API you're calling, so even if I did provide something from scratch you would probably need to amend it.


        It's probably worth re-reading my earlier post to think about which approach you'd prefer.  For example, if you have the Pro licensed version, then I would definitely recommend the data-driven approach.  If you're using the free open-source version, then I'd suggest running the checks in the test tear-down (


        You don't have to be a dev to write some Groovy script and if you are moving into API development, then now is a great opportunity to learn some scripting and call on here for help.