cancel
Showing results for 
Search instead for 
Did you mean: 

Script Assertion not running when request failed[Connection refused] in request log and no response

Highlighted
Occasional Contributor

Script Assertion not running when request failed[Connection refused] in request log and no response

Script assertion in my API request is not running when request log shows Connection refused and there is no reponse.

This happens when i run the test case as a set with multiple steps and if i run the API step manually, the assertion seems to work?

How come?

I want the script assertion to run even if the request fails as i am reading the Error log of ReadyAPI via groovy script and doing an assertion

Is there a way?

4 REPLIES 4
Highlighted
Community Leader

Re: Script Assertion not running when request failed[Connection refused] in request log and no respo

Hi @Raghav19,

 

Can you please provide any kind of screenshot of error or your groovy script.

As you have mentioned, it seems that there is some problem with groovy code.

 

 


Click "Accept as Solution" if my answer has helped, and remember to give "kudos" 🙂

Thanks and Regards,
Himanshu Tayal
Occasional Contributor

Re: Script Assertion not running when request failed[Connection refused] in request log and no respo

I have a script which triggers a specific API call step

image.png

 

 image.png

After the step calls the Create Auth Token request , I get Connection refused in my Request log but then the groovy caller code is getting marked as fail as show.

image.png

Another solution that i was trying was to read the Request Log of the API call from groovy script for which I couldnt find any

 

Highlighted
Community Leader

Re: Script Assertion not running when request failed[Connection refused] in request log and no respo

Hi @Raghav19,

 

As i see in error, it states connection refused, generally this error generates when there is some firewall settings.

Try to run this request individually, if it works individually then attached the full screenshot of groovy script.

 

 


Click "Accept as Solution" if my answer has helped, and remember to give "kudos" 🙂

Thanks and Regards,
Himanshu Tayal
Highlighted
Occasional Contributor

Re: Script Assertion not running when request failed[Connection refused] in request log and no respo

Hi @HimanshuTayal,

 

Thanks for the response. THe error that i am getting is expected and intended.

I am wondering , how come the previous step where groovy script is running my test step is getting marked as red and failing. Is it because the request is failing.

 

I would like to capture the Request log and assert something there.  if I run without the groovy script directly, I am observing , my script assertion doesnt seem to run in the API assertion

New Here?
Join us and watch the welcome video:
Top Kudoed Authors