Automated tests Robot框架集测试文档多行
我想使用KW“设置测试文档”与RobotFW的多行 返回到线路(\n)不适用于此功率Automated tests Robot框架集测试文档多行,automated-tests,robotframework,selenium2library,Automated Tests,Robotframework,Selenium2library,我想使用KW“设置测试文档”与RobotFW的多行 返回到线路(\n)不适用于此功率 有人有解决办法吗?我不确定我们是否可以直接这样做,在参考了Bryan关于这个问题的回复后,我找到了一个解决办法 在这里,多行首先在[文档]部分提到,然后本部分可由Set test文档使用 *** Variables*** ${SystemUnderTest} Staging *** Test cases*** Device Test Set Test Variable ${device}
有人有解决办法吗?我不确定我们是否可以直接这样做,在参考了Bryan关于这个问题的回复后,我找到了一个解决办法 在这里,多行首先在[文档]部分提到,然后本部分可由Set test文档使用
*** Variables***
${SystemUnderTest} Staging
*** Test cases***
Device Test
Set Test Variable ${device} iPhone
[Documentation] Device is:
... System is: ${SystemUnderTest}
Substitute vars in documentation
*** Keywords ***
Substitute vars in documentation
${doc}= replace variables ${test documentation} # This will substitute the variables in documentation with their values , ${test documentation} is an inbuilt keyword which actually parse the content of [Documentation]
set test documentation ${doc} append=True #now the set test docuemntation will take the multi line input from documentation section
有关更多详细信息,请参阅下面的链接设置多行文档很棘手,因为robot对文档有一些奇怪的规则。从用户指南标题为: 从Robot Framework 2.7.2开始,格式化HTML文档中的所有常规文本都表示为段落。实际上,由单个换行符分隔的行将合并到一个段落中,而不管是手动还是自动添加换行符多个段落可以用空行分隔(即两个换行)并且表格、列表和后续章节中讨论的其他特殊格式块也可以结束段落 简而言之,这意味着每行需要以两个换行符结尾 例如:
*** Variables ***
${var1} this is var1
${var2} this is var2
*** Test Cases ***
Example of setting multiline test documentation
set test documentation
... var1: ${var1}\n\nvar2: ${var2}
上面的内容将显示在log.html中,如下所示:
如果您的目标是记录变量的值,robot还支持创建表的简单标记。下面的示例演示如何创建表。在本例中,我使用附加到文档而不是替换文档的功能:
*** Variables ***
${var1} this is var1
${var2} this is var2
*** Test Cases ***
Example 2: documentation with embedded table
set test documentation
... | var1 | ${var1} | \n
set test documentation
... | var2 | ${var2} | \n append=True
上面的内容将显示在log.html中,如下所示:
有没有理由不使用以…(多行)开头的[Documentation]标记?Ye因为我的TC中有一些变量,我需要在文档中显示它们,并使用Set test Documentation请显示您尝试过的内容。对于一个TC,我有3或4个自定义功率。在我的KWs中,我有一些动态变量。我希望在我所有的文档中显示多行var@Antho03你能给我们看一下你的“代码”吗?例如,你想格式化的文档文本,以及你是如何尝试的。我不明白如何用多行方法显示多个变量我的变量在一个TC的许多关键字中。。。我需要看看这个TC所有我的Var与MultilePlease编辑你的问题,并添加一些代码,它很难理解你想说什么