Robot Framework web測試demo

來源:互聯網
上載者:User

標籤:

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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.