def register_keywords():
    """Register the keywords in all of the resource files."""
    resources = os.path.abspath(os.path.join(os.path.dirname(__file__), "../resources"))
    logger.info("resources=%s" % resources)
    if not os.path.isdir(resources):
        raise AssertionError("Unable to find resources directory! resources=%s" % resources)
    for filename in glob.glob(os.path.join(resources, "*.robot")):
        logger.info("looking up keywords in file %s" % filename)
        try:
            BuiltIn().import_resource(filename)
            keywords = lookup_keywords(filename)
            for keyword in keywords:
                register_run_keyword(filename, keyword, 0)
        except:
            pass
Beispiel #2
0
def verify_sid_response():
    """function to compare sid like response and the CIL response"""
    create_comp_session("AUT", "AUT")
    result = register_run_keyword(__name__, call_keyword('Execute Rest Command',"/CIL/6/ADDRESS.READ","Get",200))
    print result
    return result
# call_keyword('Execute Rest Command',["/CIL/6/ADDRESS.READ","Get",200])
from robot.libraries.BuiltIn import BuiltIn, register_run_keyword

class DynamicRegisteredLibrary:
    
    def get_keyword_names(self):
        return ['dynamic_run_keyword']
    
    def run_keyword(self, name, args):
        dynamic_run_keyword(*args)

def dynamic_run_keyword(name, *args):
    return BuiltIn().run_keyword(name, *args)

register_run_keyword('DynamicRegisteredLibrary', 'dynamic_run_keyword', 1)
from robot.libraries.BuiltIn import BuiltIn, register_run_keyword


class DynamicRegisteredLibrary:
    def get_keyword_names(self):
        return ['dynamic_run_keyword']

    def run_keyword(self, name, args):
        dynamic_run_keyword(*args)


def dynamic_run_keyword(name, *args):
    return BuiltIn().run_keyword(name, *args)


register_run_keyword('DynamicRegisteredLibrary', 'dynamic_run_keyword', 1)
Beispiel #5
0
    def keyword_only_in_library_2(self):
        print("Keyword from library 2")

    def keyword_in_both_libraries(self):
        print("Keyword from library 2")

    def keyword_in_all_resources_and_libraries(self):
        print("Keyword from library 2")

    def keyword_everywhere(self):
        print("Keyword from library 2")

    def keyword_in_tc_file_overrides_others(self):
        raise Exception("This keyword should not be called")

    def keyword_in_resource_overrides_libraries(self):
        raise Exception("This keyword should not be called")

    def no_operation(self):
        print("Overrides keyword from BuiltIn library")

    def replace_string(self):
        print("Overrides keyword from String library")
        return "I replace nothing!"

    def run_keyword_if(self, expression, name, *args):
        return BuiltIn().run_keyword_if(expression, name, *args)

register_run_keyword('MyLibrary2', MyLibrary2.run_keyword_if)
from robot.libraries.BuiltIn import BuiltIn, register_run_keyword


def run_keyword_function(name, *args):
    return BuiltIn().run_keyword(name, *args)


register_run_keyword(__name__, run_keyword_function)

def run_keyword_without_keyword(*args):
    return BuiltIn().run_keyword('\Log Many', *args)

register_run_keyword(__name__, run_keyword_without_keyword)

Beispiel #7
0
from robot.libraries.BuiltIn import BuiltIn, register_run_keyword


def run_keyword_function(name, *args):
    return BuiltIn().run_keyword(name, *args)


register_run_keyword(__name__, run_keyword_function)


def run_keyword_without_keyword(*args):
    return BuiltIn().run_keyword('\Log Many', *args)


register_run_keyword(__name__, run_keyword_without_keyword)
Beispiel #8
0
    def keyword_only_in_library_2(self):
        print("Keyword from library 2")

    def keyword_in_both_libraries(self):
        print("Keyword from library 2")

    def keyword_in_all_resources_and_libraries(self):
        print("Keyword from library 2")

    def keyword_everywhere(self):
        print("Keyword from library 2")

    def keyword_in_tc_file_overrides_others(self):
        raise Exception("This keyword should not be called")

    def keyword_in_resource_overrides_libraries(self):
        raise Exception("This keyword should not be called")

    def no_operation(self):
        print("Overrides keyword from BuiltIn library")

    def replace_string(self):
        print("Overrides keyword from String library")
        return "I replace nothing!"

    def run_keyword_if(self, expression, name, *args):
        return BuiltIn().run_keyword_if(expression, name, *args)


register_run_keyword('MyLibrary2', MyLibrary2.run_keyword_if)
from robot.libraries.BuiltIn import BuiltIn, register_run_keyword


def run_keyword_function(name, *args):
    return BuiltIn().run_keyword(name, *args)


register_run_keyword(__name__, "run_keyword_function", 1)


def run_keyword_without_keyword(*args):
    return BuiltIn().run_keyword("\Log Many", *args)


register_run_keyword(__name__, "run_keyword_without_keyword", 0)
from robot.libraries.BuiltIn import BuiltIn, register_run_keyword

class DynamicRegisteredLibrary:
    
    def get_keyword_names(self):
        return ['dynamic_run_keyword']
    
    def run_keyword(self, name, args):
        dynamic_run_keyword(*args)

def dynamic_run_keyword(name, *args):
    return BuiltIn().run_keyword(name, *args)

register_run_keyword('DynamicRegisteredLibrary', dynamic_run_keyword)
Beispiel #11
0
from robot.libraries.BuiltIn import BuiltIn, register_run_keyword


class RegisteredClass:
    def run_keyword_if_method(self, expression, name, *args):
        return BuiltIn().run_keyword_if(expression, name, *args)

    def run_keyword_method(self, name, *args):
        return BuiltIn().run_keyword(name, *args)

register_run_keyword("RegisteredClass", RegisteredClass.run_keyword_if_method)
register_run_keyword("RegisteredClass", "run_keyword_method", 1)
from robot.libraries.BuiltIn import BuiltIn, register_run_keyword


class MyLibrary2:
    def keyword_only_in_library_2(self):
        print "Keyword from library 2"

    def keyword_in_both_libraries(self):
        print "Keyword from library 2"

    def keyword_in_all_resources_and_libraries(self):
        print "Keyword from library 2"

    def keyword_everywhere(self):
        print "Keyword from library 2"

    def keyword_in_tc_file_overrides_others(self):
        raise Exception("This keyword should not be called")

    def keyword_in_resource_overrides_libraries(self):
        raise Exception("This keyword should not be called")

    def no_operation(self):
        print "Overrides keyword from BuiltIn library"

    def run_keyword_if(self, expression, name, *args):
        return BuiltIn().run_keyword_if(expression, name, *args)


register_run_keyword("MyLibrary2", MyLibrary2.run_keyword_if)
    def keyword_only_in_library_2(self):
        print("Keyword from library 2")

    def keyword_in_both_libraries(self):
        print("Keyword from library 2")

    def keyword_in_all_resources_and_libraries(self):
        print("Keyword from library 2")

    def keyword_everywhere(self):
        print("Keyword from library 2")

    def keyword_in_tc_file_overrides_others(self):
        raise Exception("This keyword should not be called")

    def keyword_in_resource_overrides_libraries(self):
        raise Exception("This keyword should not be called")

    def no_operation(self):
        print("Overrides keyword from BuiltIn library")

    def replace_string(self):
        print("Overrides keyword from String library")
        return "I replace nothing!"

    def run_keyword_if(self, expression, name, *args):
        return BuiltIn().run_keyword_if(expression, name, *args)

register_run_keyword('MyLibrary2', 'run_keyword_if', 2)
from robot.libraries.BuiltIn import BuiltIn, register_run_keyword


class RegisteredClass:
    def run_keyword_if_method(self, expression, name, *args):
        return BuiltIn().run_keyword_if(expression, name, *args)

    def run_keyword_method(self, name, *args):
        return BuiltIn().run_keyword(name, *args)


register_run_keyword("RegisteredClass", "Run Keyword If Method", 2)
register_run_keyword("RegisteredClass", "run_keyword_method", 1)
from robot.libraries.BuiltIn import BuiltIn, register_run_keyword


def run_keyword_function(name, *args):
    return BuiltIn().run_keyword(name, *args)


register_run_keyword(__name__, 'run_keyword_function', 1)


def run_keyword_without_keyword(*args):
    return BuiltIn().run_keyword('\Log Many', *args)


register_run_keyword(__name__, 'run_keyword_without_keyword', 0)
Beispiel #16
0
from robot.libraries.BuiltIn import BuiltIn, register_run_keyword


class RegisteredClass:
    def run_keyword_if_method(self, expression, name, *args):
        return BuiltIn().run_keyword_if(expression, name, *args)

    def run_keyword_method(self, name, *args):
        return BuiltIn().run_keyword(name, *args)


register_run_keyword("RegisteredClass", RegisteredClass.run_keyword_if_method)
register_run_keyword("RegisteredClass", "run_keyword_method", 1)
    def keyword_only_in_library_2(self):
        print("Keyword from library 2")

    def keyword_in_both_libraries(self):
        print("Keyword from library 2")

    def keyword_in_all_resources_and_libraries(self):
        print("Keyword from library 2")

    def keyword_everywhere(self):
        print("Keyword from library 2")

    def keyword_in_tc_file_overrides_others(self):
        raise Exception("This keyword should not be called")

    def keyword_in_resource_overrides_libraries(self):
        raise Exception("This keyword should not be called")

    def no_operation(self):
        print("Overrides keyword from BuiltIn library")

    def replace_string(self):
        print("Overrides keyword from String library")
        return "I replace nothing!"

    def run_keyword_if(self, expression, name, *args):
        return BuiltIn().run_keyword_if(expression, name, *args)


register_run_keyword('MyLibrary2', 'run_keyword_if', 2)
Beispiel #18
0
from robot.libraries.BuiltIn import BuiltIn, register_run_keyword


class DynamicRegisteredLibrary:
    def get_keyword_names(self):
        return ['dynamic_run_keyword']

    def run_keyword(self, name, args):
        dynamic_run_keyword(*args)


def dynamic_run_keyword(name, *args):
    return BuiltIn().run_keyword(name, *args)


register_run_keyword('DynamicRegisteredLibrary', dynamic_run_keyword)