Robot Framework web测试demo

1.Open RIDE: ride.py


2.New Project: "File" -> "New Project" ,click "OK".
    Name:Robot_Demo
    Type:Directory
ps:The difference between File and Directory is: We can write test case in File ,but Directory not.
Robot Framework test data is defined in tabular format, using either hypertext markup language (HTML), tab-separated values (TSV), plain text, or reStructuredText (reST) formats.


3.right click "Robot_Demo",choose "New Resource".click "OK".
    Name:resource
ps:We could put variables and higher-level user keywords in this file,then make testsuite invoked this resource file .


4.Import "selenium2library":Open "resource.txt",click "Library",input "Selenium2Library" in "Name".Click "OK".


5. right click "Robot_Demo",choose "New Suite" ,click "OK".
    Name:TestSuite1
    Type:File


6.Import "resource.txt":Open "TestSuite1",click "Resource",input "resource.txt" in "Path".Click "OK".


7.right click "TestSuite1" , choose "New Test Case",click "OK".
    Name:TestCase1


8.Edit test case "TestCase1":
    Open Browser    http://www.baidu.com    
    Maximize Browser Window        
    Input Text    id=kw    Robot
    Click Button    id=su    
    Close Browser        
ps: "Open Browser" is a selenium defined keyword, so it's marked with blue color.We could search all the keyword by "F5".
We could also set every test case with a "Tags": Edit->Settings->Tags.So that we could run test cases with special tags.


9.Run. Click Tab page "Run"->"Start".Then we could see the browser open with "http://www.baidu.com".


10.After it finished running,we could see the report by "Run"->"Report".
ps: If it failed,we could find the failed step screen shot in log: Run-> Log.

原文地址:https://www.cnblogs.com/miniren/p/4885752.html