Open
Description
Description:
I want to use a Robot Framework listener to dynamically set the execution time for each test case during test execution. For example, in a CI scenario, I can define a total execution time, and during the Robot Framework run, dynamically adjust the remaining execution time for each test case.
However, it seems that there is currently no way to modify a test case's timeout parameter through a listener:
from robot import result, running
from testlogging import debug_log
logger = debug_log(__file__)
class TimeoutConfig:
ROBOT_LISTENER_API_VERSION = 3
def __init__(self, timeout: str):
self.timeout = timeout
def start_test(self, data: running.TestCase, result: result.TestSuite):
logger.info('ROBOT LISTENER: Test Case {} has timeout {}', data.name, data.timeout)
data.timeout = self.timeout
logger.info('ROBOT LISTENER: Test Case {} has timeout {}', data.name, data.timeout)
Test case:
Suite Teardown Suite Teardown
*** Test Cases ***
Log Hello World
[Timeout] 5
[Teardown] Testcase Teardown
Sleep 20
The console shows data.timout output was modified but the robot report shows the timeout still keep original.