码迷,mamicode.com
首页 > Web开发 > 详细

Robot Framework web测试demo

时间:2015-10-16 18:20:00      阅读:206      评论:0      收藏:0      [点我收藏+]

标签:

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.

Robot Framework web测试demo

标签:

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!