Forum Discussion

Musaffir's avatar
Musaffir
Contributor
8 years ago
Solved

How to apply common assertions at Project or Suite Level

Hi,

 

I have a test suite in soapUi which has many test cases .

And each test cases contains multiple REST requests tests steps as well.
I would like to add assertions for all of those requests test steps , but I don’t want to add common types of assertions at each and every request level. Say for example I want to add assertions for http response status code .

This assertion is going to be a common one and it should be checked for all the requests .

Adding this common assertion for each and every test step is going to be a manual effort , and looking for a better approach.


Instead of adding this at every request level, is it possible to add at test suite / test case level or some other way, so when the execution of suite happens , this gets checked for all the requests.


I use free version of soapUI

 

 

Thanks & Warm Regards
Musaffir

  • One workaround that I have found is ,

    Write a groovy class with what ever assertions methods that you want to include , compile , make a jar of it and place to the {{..SmartBear\SoapUI-5.2.1\bin\ext}} folder of your soapui installation.

     

    Restart your soapui

     

    Go to the request step and add a script assertions, where import the groovy class and invoke the assertion method you have written, you may pass and context variable available like log, messageExchange etc ..

     

    If you have many request steps, this will still have to be added to each and every if those needs to be tested , but certainly avoid or reduce writing or adding same type of assertions manually to each and every request step.

     

    If you know any better approach , pls do let me know 

     

    Thanks

    Musaffir

1 Reply

  • One workaround that I have found is ,

    Write a groovy class with what ever assertions methods that you want to include , compile , make a jar of it and place to the {{..SmartBear\SoapUI-5.2.1\bin\ext}} folder of your soapui installation.

     

    Restart your soapui

     

    Go to the request step and add a script assertions, where import the groovy class and invoke the assertion method you have written, you may pass and context variable available like log, messageExchange etc ..

     

    If you have many request steps, this will still have to be added to each and every if those needs to be tested , but certainly avoid or reduce writing or adding same type of assertions manually to each and every request step.

     

    If you know any better approach , pls do let me know 

     

    Thanks

    Musaffir