Last active
January 3, 2016 20:09
-
-
Save oiuww09fn/8513583 to your computer and use it in GitHub Desktop.
Robot Framework Test Data Demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*** Keywords *** | |
a simple for loop | |
[documentation] just a for loop test | |
# in range | |
:for ${i} in range 10 | |
\ run keyword if ${i} == 6 exit for loop | |
\ log ${i} | |
# 比较英文字符串,break | |
:for ${i} in hello1 hello2 hello3 | |
\ run keyword if '${i}' == 'hello2' exit for loop | |
\ log ${i} | |
# 比较中文字符串, break | |
:for ${i} in 你 我 它 | |
\ run keyword if '${i}' == '我' exit for loop | |
\ log ${i} | |
# 多循环变量应用 | |
:for ${i} ${j} in | |
\ ... 1 one | |
\ ... 2 two | |
\ ... 3 three | |
\ run keyword if '${i}' == '2' exit for loop | |
\ log ${i} ${j} | |
*** test cases *** | |
test for loop | |
a simple for loop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*** Settings *** | |
Documentation fdasfda | |
Test Setup Log test setup # 会被测试用例中的覆盖 | |
Test Teardown Log test teardown # 同上 | |
Force Tags demo settings_force_tags # 测试文件或测试集中的所有测试用例都将得到该tag,不会被case中的tag覆盖。 | |
Default Tags demo settings_default_tags # case中如果没有tags,则用default tags,如果有,defaul tags无效。 | |
Library String | |
Resource ${RESOURCES}/resource.txt | |
Variables ${RESOURCES}/var.py # 可接受参数,大小写都行,但通常全局变量推荐大写。 | |
*** Test Cases *** | |
Test case demo | |
[Documentation] 用例注释 | |
[Tags] demo in_test_case # 此处设置tags,defaul tags就没用了。 | |
[Setup] Log case setup | |
[Template] # 指定测试用例模版,测试本身只包含数据,用于关键字参数 | |
[Timeout] # 设置超时 | |
Log Just a test | |
[Teardown] Log case tear down | |
*** Keywords *** | |
a keyword example | |
[Arguments] ${arg1} ${arg2} | |
[Documentation] keyword setting | |
Log a keyword | |
[Return] ${arg1} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment