如何告诉机器人框架不要记录关键字? [英] 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
但我宁愿不在那里.我如何告诉 Robot Framework 不记录该行?
But I would rather not have it there. How can I tell Robot Framework to just not log that line?
------编辑------
------edit------
看起来应该这样做:
pybot --removekeywords NAME:SetVariable testcase.txt
但是 Set Variable 关键字仍然存在.
But the Set Variable keywords are still there.
(是的,我将我的机器人框架升级到 2.8.3 以利用此功能.)
(And yes, I upgraded my robot framework to 2.8.3 to take advantage of this function.)
推荐答案
问题是,当你分配一个像 ${var} = Keyword
这样的变量时,Robot Framework 输出的关键字名称是 ${var} = Keyword
,而不是您期望的 Keyword
.如果您的关键字来自库或资源文件,则其名称也将包含在内,如 ${var} = MyLibrary.Keyword
.后者是一个功能,但前者是一个 bug,即希望在 RF 2.9 中修复.
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'
这篇关于如何告诉机器人框架不要记录关键字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!