Ask a Question

Terminate Groovy Script (hanging)

Occasional Contributor

Terminate Groovy Script (hanging)



I am connecting to a database via Groovy Script but it just hangs when try to clear properties from Database and I then have to restart Ready API.  Is there a way to stop/terminate a groovy script if the test step goes for a certain amount of time or add groovy within the step to cancel it?  I can't stop the test and the Test Case Timeout doesn't work.




Community Leader

Hello @Rememo 


I am sorry i don't have direct answer...  I can only share something that I have done when in similar situation...


Hopefully you have some sort of loop in the clear properties activity you mention.  I put a small evaluation of the existence of a file at the top of the loop.  If the file exists, i remain in the loop doing the desired activity.  If the file does not exist, the loop exits gracefully and finishes the groovy script where the test case can then be terminated.  In the event you feel the activity is hung, you can be in Windows File Explorer and delete the file to get the script to terminate without needing to exit out of ReadyAPI.   I have a line of code to create an empty file at the beginning of the groovy execution so I don't have to worry about it being there when the groovy script runs.


I have been in your same position.  At least the ReadyAPI project save mechanism is usually still available in order to save your project if you have been working on it before running the script that goes south.  Once I know the hang is a possibility, i add that simple "kill switch" to the groovy code.




Showing results for 
Search instead for 
Did you mean: