Difference between Delay() and time.sleep() (python)
Does someone know the qualitative difference between TestCompletes innate 'Delay()' and time.sleep() in Python? I currently have a listener to a connection to ActiveMQ via stomp, and whenever a message arrives the listener will open a file and write the message to this file. Whenever I ran the code nothing was written in the file and when I tried deleting it I got an error stating that TC was still using this file. After some debugging I switched out TC:s innate Delay() to time.sleep() and then everything suddenly works.
Use the aqUtils. Delay method to delay the script execution for a period of time. You may want to delay the script execution when the application under test is performing some time-consuming operations (for example, when it is loading a database or connecting to a network computer).
The sleep() function suspends (waits) execution of the current thread for a given number of seconds.
Hi,
> I currently have a listener to a connection to ActiveMQ via stomp
Are the listener and other test code exist in the same TestComplete's project and are executed concurrently?
If yes, then note that multithreaded test code is not officially supported by TestComplete. It might work for certain script engines (like Python) but nothing is guaranteed.
Instead, I would implement a listener in a separate script and execute it in the standalone Python instance (probably, started from TestComplete when needed and terminated when done) and in TestComplete itself leave only the part that checks the content of the file.