In order to support an alternative logging format I\'ve started the development of a custom Robotframework Listener. Using the examples in the guide I\'ve been able to repli
You are trying to reference BuiltIn()
before the test starts. That is what is meant by the error Cannot access execution context
: the test hasn't started so there is no execution context. Simply put, you cannot access methods of the BuiltIn
library before the test runs.
You will have to wait to call that statement until after the test has started running.
For example:
class listener:
ROBOT_LISTENER_API_VERSION = 2
def start_suite(self, name, attrs):
self.suite_source = BuiltIn().get_variable_value('${SUITE SOURCE}')
However, if all you need is the source of the current suite, that information is available in the listener method start_suite
.
For example:
class MyListener:
ROBOT_LISTENER_API_VERSION = 2
def start_suite(self, name, attrs):
self.suite_source = attrs["source"]