标签:
此外,还有:
Table name | Used for | Aliases |
Setting table | 1.导入测试库,资源文件和变量文件 2. 为测试集和测试用例定义元数据 |
Setting Settings Metadata |
|
定义可以用在其他地方的测试数据的变量 | Variable Variables |
Test case table | 通过可用的关键字创建测试用例。 | Test case Test cases |
Keyword table
|
通过低级别关键字创建用户自定义关键字 |
Keyword
Keywords
User Keyword
User Keywords
|
Setting | Value | Comment |
Library | OperatingSystem | |
Library | testlibs/LoginLibrary.py | #导入用户自定义库 |
Test Setup | Clear Login Database | #每个测试用例执行时会先执行setup |
Test Teardown | #每个测试用例执行完后会执行teardown |
Test Case | Action | Argument | Argument | Argument |
User can create an account and log in | Create Valid User | fred | P4ssw0rd | #关键字驱动,即:调用keyword表中的同名关键字 |
Login | fred | P4ssw0rd | ||
Creating user with invalid password should fail | [Template] | Creating user with invalid password | #加上[Template]后则关键字驱动变为数据驱动 | |
abCD5 | ${PWD INVALID LENGTH} | |||
abCD567890123 | ${PWD INVALID LENGTH} |
Keyword | Action | Argument | Argument | Argument |
Clear Login Database | Remove file | ${DATABASE FILE} | ||
Create Valid User | [Arguments] | ${username} | ${password} | #定义关键字可以理解为定义函数实现 |
Create user | ${username} | ${password} | #Create User为LoginLibrary.py中定义的关键字,robot Framework会忽略下划线 | |
Status should be | SUCCESS | #同上 | ||
Login | [Arguments] | ${username} | ${password} | |
Attempt to login with credentials | ${username} | ${password} | #同上 | |
Status Should Be | Logged In | |||
Creating user with invalid password | [Arguments] | ${password} | ${error} | |
Create user | username | ${password} | ||
Status should be | Creating user failed: ${error} | |||
Variable | Value |
${DATABASE FILE} | ${TEMPDIR}${/}robotframework-quickstart-db.txt |
${PWD INVALID LENGTH} | Password must be 7-12 characters long |
Test Case | Action | Argument | Argument |
One return value | ${return} = | Return one value | |
Should Be Equal | ${return} | one | |
Two return values | @{list}= | Return two values | |
${first} | ${second} = | Return two values | |
Keyword | Action | Argument | Argument |
Return one value | [Return] | one | |
Return two values | [Return] | one | two |
Setting | Value |
Resource | Variable.html |
Resource | keyword.html |
转:http://www.360doc.com/content/11/1230/10/54470_176015885.shtml
标签:
原文地址:http://www.cnblogs.com/xh0102/p/5776601.html