Robot Framework Test Data Table格式

上一篇 / 下一篇  2017-07-11 17:33:59 / 个人分类:RF

Robot Framework支持的Test Data Table格式很多,像HTML格式的.html,.htm,.xhtml, TSV格式的.tsv, 普通文本格式的.txt和.robot,reStructured格式的.rst和.rest

今天来说下普通文本格式
这种格式是最好编辑的,用notepad++之类的编辑器即可。这种格式的seperator通常可以用两个或两个以上的空格进行分割(允许多个空格使得我们可以排版出更美观的test data table),也可以用管道符号|进行分割。(TSV格式用Tabs键分割)
如下面的例子
*** Settings ***
Library       OperatingSystem

*** Variables ***
${MESSAGE}    Hello, world!

*** Test Cases ***
My Test
    [Documentation]    Example test
    Log    ${MESSAGE}
    My Keyword    /tmp

Another Test
    Should Be Equal    ${MESSAGE}    Hello, world!

*** Keywords ***
My Keyword
    [Arguments]    ${path}
    Directory Should Exist    ${path}
--------------------------------分割符---------------------------------
| *Setting*  |     *Value*     |
| Library    | OperatingSystem |

| *Variable* |     *Value*     |
| ${MESSAGE} | Hello, world!   |

| *Test Case*  | *Action*        | *Argument*   |
| My Test      | [Documentation] | Example test |
|              | Log             | ${MESSAGE}   |
|              | My Keyword      | /tmp         |
| Another Test | Should Be Equal | ${MESSAGE}   | Hello, world!

| *Keyword*  |
| My Keyword | [Arguments] | ${path}
|            | Directory Should Exist | ${path}

TAG:

 

评分:0

我来说两句

Open Toolbar