A utility for defining and decorating test library classes and methods in Robot Framework. Use this to simplify keyword registration and library metadata management.
# Source: https://github.com/robotframework/robotframework | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
from robot.api.deco import keyword, library
@library
class LibraryDecorator:
def not_keyword(self):
raise RuntimeError("Should not be executed!")
@keyword
def decorated_method_is_keyword(self):
print("Decorated methods are keywords.")
@staticmethod
@keyword
def decorated_static_method_is_keyword():
print("Decorated static methods are keywords.")
@classmethod
@keyword
def decorated_class_method_is_keyword(cls):
print("Decorated class methods are keywords.")
@library(version="base")
class DecoratedLibrar
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key