Ask a Question

Asserting response at project level

meetu1
New Contributor

Asserting response at project level

Hi,

I have lot of requests in my test suite on which I am asserting the http status code and status of my response. Is it possible to add a common assertion or groovy script at project or test suite level which will run for all test steps if assertions are same for all test steps.

 

Thanks

3 REPLIES 3
HimanshuTayal
Community Hero

Re: Asserting response at project level

Hi @meetu1,

 

I think this approach of asserting the response at Test Suite Level is not good because you will come to know about any Environment down or other issues after the execution of each and every Test Case.

 

Best Approach is assert each and every Request you are adding into Test Case.

 

For the Solution of your Scenario:

 

Write a groovy class with assertions that you want to include , make a jar and place it in the {{..\bin\ext}} folder of SoapUI/ReadyAPI. 

Restart SoapUI/ReadyAPI. 

Go to the request step and add script assertions, import groovy class and invoke the assertion method written in jar.

 

Do Like if you Find this as solution

 

Thanks,

Himanshu Tayal


Click "Accept as Solution" if my answer has helped,
Remember to give "Kudos" πŸ™‚ ↓↓↓↓↓



Thanks and Regards,
Himanshu Tayal
meetu1
New Contributor

Re: Asserting response at project level

Thanks @HimanshuTayal I already have script assertions at the request level but was wondering if there is any way to add them at project level as all my requests have similar assertions so instead of adding assertion at each request if I could use some event listener which would assert the response of each request.

jhanzeb1
Frequent Contributor

Re: Asserting response at project level

Good question. The simple answer would be - not at a project or testsuite level. However, I understand you do not want to keep repeating same thing everywhere so therefore you could have a groovy script in a class to assert for your response code and all you have to do is to ensure you call that script from the script library in your responses.

 

https://www.soapui.org/scripting-properties/scripting-and-the-script-library.html

Might be able to help you πŸ™‚

cancel
Showing results forΒ 
Search instead forΒ 
Did you mean:Β