Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I tell robot framework not to log a keyword?

In a robot framework test case I set a variable and then do a process.

Because the setting of the variable is not a very interesting bit of information, I don't want to include that in my report.

| Verifying STUFF  |
| | ${endpoint}=    | set variable | STUFF
| | Verify

My report contains this:

KEYWORD: ${endpoint} = BuiltIn.Set Variable STUFF

But I would rather not have it there. How can I tell Robot Framework to just not log that line?

------edit------

It looks like this should do it:

pybot --removekeywords NAME:SetVariable testcase.txt

But the Set Variable keywords are still there.

(And yes, I upgraded my robot framework to 2.8.3 to take advantage of this function.)

like image 778
Skip Huffman Avatar asked Nov 15 '13 19:11

Skip Huffman


2 Answers

The best you can do is to use

Set Log Level    NONE

but it will still log all the keyword calls, just not anything inside those.

Or if you call a python function which calls another function, then the call to the second function is not logged.

Like this:

*** Settings ***
Library           lib.py

*** Test Cases ***
demo
    Set Log Level    NONE
    ${a}    foo
    xyzzy

*** Keywords ***
xyzzy
    qwerty

qwerty
    No Operation
    Log    123

and lib.py being like this:

def foo():
    abc = bar()
    return abc

def bar():
    c = 1
    print c
    return c
like image 77
Harri Avatar answered Sep 21 '22 19:09

Harri


The problem is that when you assign a variable like ${var} = Keyword, the name of the keyword in Robot Framework outputs is ${var} = Keyword, not Keyword as you would expect. If your keyword is from a library or a resource file, its name will also be included like ${var} = MyLibrary.Keyword. The latter is a feature but the former is a bug that is hopefully fixed in RF 2.9.

An easy workaround for the keyword name, for now, including the variable name is using wildcards. Something like this ought to work for you:

--RemoveKeywords 'name:* = BuiltIn.Set Variable'
like image 30
Pekka Klärck Avatar answered Sep 19 '22 19:09

Pekka Klärck