在关键字中添加注释,以便在RF中更好地理解



有什么方法可以在关键字中添加注释,以更好地了解RF中的测试步骤?

我们可以在不定制硒2元的情况下实现这一目标吗?

eg-单击元素id = loginbutton。我们想在log.html文件中添加注释"尝试单击登录按钮"

谢谢

这就是为

创建的"内置"
Comment            Trying to click login button
Click Element      id=loginButton  

#字符可用于注释。这在《机器人框架用户指南》的解析部分中提到了这一点。

*** Keywords ***
Example keyword
    # comments can be on a line by themself
    one keyword
    another keyword  # or inline, as long as they start in a new cell.

如果您希望注释出现在日志中,则可以使用注释关键字,该关键字将与日志中的任何其他关键字相同。您也可以使用日志关键字来获得相同的效果。

*** Keywords ***
Example keyword
    comment  this will appear as a step in the log
    log      this will also appear as a step in the log

没有其他方法可以将信息注入日志。

如果您想在日志文件中查看条目"尝试单击登录按钮"时单击此操作,单击为单独和顶级级别,将实际操作包装在关键字中用那个名字:

*** Keywords ***
Trying to click login button
    Click Element      id=loginButton

因此,日志将具有用户友好的命名,而不是实际的硒调用。
它可能是一次操作的过度杀伤力,但它使日志更容易理解,更容易遵循,尤其是对于非技术团队成员(PM,TechPub等)

我建议使用 [Documentation]

*** Keywords ***
Create Perf Streams
[Documentation]  Creates minimal length Performance UDP Streams

其他工具将解决此字段,以创建LIBS的不错的自动文档

最新更新