Reloading test libraries after code changes at runtime

337 views
Skip to first unread message

vbs

unread,
Jan 14, 2016, 11:22:31 AM1/14/16
to robotframework-users
Gentlemen,

I have a couple of custom test libraries. Also I have a continuously running python server that executes test cases on demand by invoking rebot() from inside python code.
The problem is:
When I change the code inside my test libraries then rebot doesn't make use of these changes. So it is running the code it initially started with. How can I force robot framework to reload all test libraries when (or before) I call rebot?

I noticed that since RF 2.9 there is BuiltIn.ReloadLibrary keyword:

But I am not sure if that is what I need. I can only reload a single library it seems. Also there is the python 'reload' function to refresh a module. But I didn't find a good way to use it either.

Has anybody ideas how to do this in a clean way?

I am on RF 2.9.7

Thank you guys
Robin

Pekka Klärck

unread,
Jan 15, 2016, 4:50:19 AM1/15/16
to robin...@gmail.com, robotframework-users
Hello,

It is always problematic to reload Python modules because they are
cached in sys.modules. In addition to that, Robot has its own internal
caches. I would recommend you to enhance your server to allow
restarting it when there are changes to libraries. You could even make
restart automatic by polling are there changes to libraries.

Cheers,
.peke
> --
> You received this message because you are subscribed to the Google Groups
> "robotframework-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to robotframework-u...@googlegroups.com.
> To post to this group, send email to robotframe...@googlegroups.com.
> Visit this group at https://groups.google.com/group/robotframework-users.
> For more options, visit https://groups.google.com/d/optout.



--
Agile Tester/Developer/Consultant :: http://eliga.fi
Lead Developer of Robot Framework :: http://robotframework.org

vbs

unread,
Jan 15, 2016, 6:01:52 AM1/15/16
to robotframework-users
Thanks for you answer Pekka. 
The problem is that my server is a job queue for test jobs. So restarting it would mean to lose the current queue and also the current test.

But well, since it seems there is no clean solution I will try to cope with restarting.

Cheers,
Robin

Cooper Yang

unread,
Jan 29, 2018, 9:24:01 AM1/29/18
to robotframework-users
I encountered this issue as well in RF 3.0.2.
It seems undone tasks can be stored in redis (if your adopt celery + redis to handle task schedule), but that is not really what I expect.
So could your share your solution?

Thanks
-Cooper
Reply all
Reply to author
Forward
0 new messages