robotframework icon indicating copy to clipboard operation
robotframework copied to clipboard

`Run Keyword` without logging as new Keyword

Open Snooz82 opened this issue 5 years ago • 6 comments

Run Keyword is a super handy and nice solution to execute keyword that are not part of the current library.

Example: Run a Keyword in failure like in SeleniumLibrary or Browser, or own WUKS implementation.

The only downside is, that it is not possible to NOT getting the called keyword as new Keyword-Layer in docs.

The feature requested is, that there could be way to disable Keyword beeing put to logs, when called by Run Keyword. Logging (INFO and DEBUG, etc) should just be in the context of the calling keyword.

For me it would be good enough if there would be a python way to do it. I wouldn't need this option within Robot code.

Cheers René

Snooz82 avatar Aug 24 '20 20:08 Snooz82

@Snooz82 - I would also appreciate such option!

sebastianciupinski avatar Aug 26 '20 11:08 sebastianciupinski

Could you clarify the need in a bit more detail? Run Keyword doesn't do much logging on INFO or DEBUG level even now.

pekkaklarck avatar Aug 27 '20 08:08 pekkaklarck

@pekkaklarck I am not sure if this is the case, but code like this:

from robot.libraries.BuiltIn import BuiltIn

class example:
    def custom_kw(self, a, b):
        BuiltIn().run_keyword("Should Be Equal", a, b)
*** Settings ***
Library    example.py


*** Test Cases ***
A
    Custom Kw   9    9

Produces Log like this (where should be equal is child of custom kw)

image

sebastianciupinski avatar Aug 27 '20 12:08 sebastianciupinski

Yes exactly.

I had this issue several times. I would propose to have some kind of possibility to "mute" the logger. I know that there are monkey patching possibilities but this is ugly and robot should support this directly.

Snooz82 avatar Apr 07 '21 22:04 Snooz82

run_keyword

I've got the same result when using Run Keyword. However, I don't really understand why don't you just use like this instead.

from robot.libraries.BuiltIn import BuiltIn

class example:
    def custom_kw(self, a, b):
        BuiltIn().should_be_equal(a, b)

This way it omits the log as you proposed.

peerasut avatar Apr 28 '22 14:04 peerasut