1、Python版本
2、robotframework安装
3、安装检验
4、quick start的操作说明1.下载并解压文件:https://github.com/robotframework/QuickStartGuide.git
E:\QuickStartGuide-master>python sut/login.py login create fred P4ssw0rd
Usage: login.py { create | login | change-password | help }
E:\QuickStartGuide-master>python sut/login.py login nobody P4ssw0rd
Access Denied
E:\QuickStartGuide-master>python sut/login.py create fred P4ssw0rd
SUCCESS
E:\QuickStartGuide-master>python sut/login.py login fred P4ssw0rd
Logged In
E:\QuickStartGuide-master>python sut/login.py login fred shortAccess Denied
E:\QuickStartGuide-master>python sut/login.py create fred shortCreating user failed: Password must be 7-12 characters longE:\QuickStartGuide-master>python sut/login.py create fred invalid
Creating user failed: Password must be a combination of lowercase and uppercase
letters and numbers
E:\QuickStartGuide-master>python sut/login.py change-password fred wrong NeeP4ss
Changing password failed: Access Denied
E:\QuickStartGuide-master>python sut/login.py change-password fred P4ssw0rd shor
t
Changing password failed: Password must be 7-12 characters longE:\QuickStartGuide-master>python sut/login.py change-password fred P4ssw0rd NewP4ss
SUCCESS 5、执行QuickStart.rst中的用例
6、用例的组成部分说明
*** Test Cases ***
*** Settings ***
*** Keywords ***
*** Variables ***
*** Variables ***
${USERNAME} janedoe
${PASSWORD} J4n3D0e
${NEW PASSWORD} e0D3n4J
${DATABASE FILE} ${TEMPDIR}${/}robotframework-quickstart-db.txt
${PWD INVALID LENGTH} Password must be 7-12 characters long
${PWD INVALID CONTENT} Password must be a combination of lowercase and uppercase letters and numbers
*** Keywords ***
Clear login database
Remove file ${DATABASE FILE}Create valid user
[Arguments] ${username} ${password}
Create user ${username} ${password}
Status should be SUCCESS
Creating user with invalid password should fail
[Arguments] ${password} ${error}
Create user example ${password}
Status should be Creating user failed: ${error}Login
[Arguments] ${username} ${password}
Attempt to login with credentials ${username} ${password}
Status should be Logged In# Keywords below used by higher level tests. Notice how given/when/then/and# prefixes can be dropped. And this is a comment.A user has a valid account
Create valid user ${USERNAME} ${PASSWORD}She changes her password
Change password ${USERNAME} ${PASSWORD} ${NEW PASSWORD}
Status should be SUCCESS
She can log in with the new password
Login ${USERNAME} ${NEW PASSWORD}She cannot use the old password anymore
Attempt to login with credentials ${USERNAME} ${PASSWORD}
Status should be Access Denied
*** Settings ***
Library OperatingSystem
Library lib/LoginLibrary.py
Suite Setup Clear Login Database
Test Teardown Clear Login Database
Force Tags quickstartDefault Tags example smoke
*** Test Cases ***
User can create an account and log in
Create Valid User fred P4ssw0rd
Attempt to Login with Credentials fred P4ssw0rd
Status Should Be Logged In
User cannot log in with bad password
Create Valid User betty P4ssw0rd
Attempt to Login with Credentials betty wrong
Status Should Be Access Denied
User can change password
Given a user has a valid account
When she changes her password
Then she can log in with the new password
And she cannot use the old password anymore
Invalid password
[Template] Creating user with invalid password should fail
abCD5 ${PWD INVALID LENGTH}
abCD567890123 ${PWD INVALID LENGTH}
123DEFG ${PWD INVALID CONTENT}
abcd56789 ${PWD INVALID CONTENT}
AbCdEfGh ${PWD INVALID CONTENT}
abCD56+ ${PWD INVALID CONTENT} 7、总结
写在最后
|
|