Forum Discussion

AymenFNZ's avatar
AymenFNZ
Frequent Visitor
2 years ago

Load the library dynamically WITHOUT Thread.sleep

Hi,

 

Here https://support.smartbear.com/readyapi/docs/testing/scripts/libs/groovy-lib.html at the bottom of the page, it says how to dynamically load a lib.

 

However the solution proposed isn't qualitative; it says to do a Thread.sleep(3000)... But this isn't a guarantee that the lib is effectively loaded!

 

As proof, I did this in my "Setup script" of my test suite, like this:

 

String customGroovyLibsPath = (new File(testSuite.project.getPath())).getParent() + File.separator + "GroovyLibs"

if (System.properties[ 'soapui.scripting.library' ] != customGroovyLibsPath) {
	System.properties[ 'soapui.scripting.library' ] = customGroovyLibsPath
	Thread.sleep(3000)
}

 

 On the first execution of my test suite, most of the time, it ends up in an error.

 

So, my question is how can I make "absolutely" sure my library is fully loaded, without using Thread.sleep and passing to it an arbitrary big amount of time?

No RepliesBe the first to reply