Inherit running resources from a robot.run python application

Hello,

I’ve been breaking my brain over trying to implement the following situation:

I’m building a python application that allows an operator to start test cases and review the tests. These testcases are implemented by running tests on a ZigBee embedded device connected to a laptop. The python framework is also connected to a backend, this is the UI for the operator. Now for the issue I’m running into.

When using the robot.run(‘xxx.robot’) function it cannot use the resources that have been started with the python framework. For example a serial connection already made to an embedded device (It needs to be closed in the python framework before calling robot.run() to reopen it) or the connection to a backend server to update test progress and results step by step. These have to be reinitialized every time I run a test case via robot.run(). Which is a horrible workaround for not being able to share objects created before calling the robot.run() function.

I’ve read through the documentation and cannot find something that can aid me with the creation of an object (Say: serial connection) and then using that object on a new test case.

Thank you for reading all this, I hope my question makes sense, otherwise please ask and I shall inform you more.

Please consider next thoughts as theoretical, because I never adventured in this complex Library creation.

You need to make a complete working library in a way that it can work outside of Python and at RF space. So, you library will use the existing code to create the connection to the device, and then if you need to use it on Python space, you instantiate the Library from there. This is the use of, for example, SeleniumLibrary, to have webdriver available on both Python space and calls to the Keywords.

Hope it helped.

Thank you for the response Guilherme,

I understand what you mean. Unfortunately that means I would have to constantly close and reopen the communication resources. For now the solution I have chosen is running a seperate python application that performs the Robot Framework tasks and sends the request to the main application via RPC.

Thank you anyway :slight_smile: