Introduction to Robot Framework
Upcoming SlideShare
Loading in...5
×
 

Introduction to Robot Framework

on

  • 1,011 views

In this session, we'll focus on the essential parts of the Robot Framework and illustrate how the famous web testing tool Selenium can be integrated.

In this session, we'll focus on the essential parts of the Robot Framework and illustrate how the famous web testing tool Selenium can be integrated.

Statistics

Views

Total Views
1,011
Views on SlideShare
991
Embed Views
20

Actions

Likes
7
Downloads
22
Comments
0

3 Embeds 20

https://www.linkedin.com 12
http://www.plurk.com 4
http://www.slideee.com 4

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Introduction to Robot Framework Introduction to Robot Framework Presentation Transcript

  • INTRODUCTION TO ROBOT FRAMEWORK Carl Su! 18 May 2014
  • Hi
  • 歡迎來到 PyCon APAC 2014
  • Hackpad 討論串 #pyconapac2014r4
  • Who! am! I? Photo credit: paurian CC BY-NC 2.0
  • 甚麼是 Robot Framework?
  • 通⽤用⾃自動化測試框架
  • ⾼高度彈性
  • 開放原始碼
  • Why?
  • Clear • 表格式語法,淺顯易懂 • 可根據現有關鍵字建⽴立新的關鍵字 test cli gui config r3 r7 r4 doc examples quickstart lib parallel retry robot
  • Easy • 不相依特定平台或應⽤用程式 • 透過 CLI 進⾏行測試,輸出精美報表
  • Modular • 提供⼀一組 API,可輕易擴充關鍵字 • ⽀支援整合 Selenium, Telnet, SSH 等環境 • ⽀支援變數,⽅方便測試不同環境
  • EXAMPLES
  • System Under Test Robot Framework Selenium2Library Test Implementation (test suites, resource files) Web browser
  • carl@pyconapac2014 ~/D/WebDemo> pip install robotframework robotframework-selenium2library
  • carl@pyconapac2014 ~/D/WebDemo> python demoapp/server.py Demo server starting on port 7272.
  • carl@pyconapac2014 ~/D/WebDemo> xvfb-run pybot login_tests
  • *** Settings *** Documentation A test suite with a single test for valid login. ... ... This test has a workflow that is created using keywords in ... the imported resource file. Resource resource.txt ! *** Test Cases *** Valid Login Open Browser To Login Page Input Username demo Input Password mode Submit Credentials Welcome Page Should Be Open [Teardown] Close Browser
  • *** Settings *** Suite Setup Open Browser To Login Page Suite Teardown Close Browser Test Setup Go To Login Page Test Template Login With Invalid Credentials Should Fail Resource resource.txt ! *** Test Cases *** User Name Password Invalid Username invalid ${VALID PASSWORD} Invalid Password ${VALID USER} invalid Invalid Username And Password invalid whatever Empty Username ${EMPTY} ${VALID PASSWORD} Empty Password ${VALID USER} ${EMPTY} Empty Username And Password ${EMPTY} ${EMPTY} ! *** Keywords *** Login With Invalid Credentials Should Fail [Arguments] ${username} ${password} Input Username ${username} Input Password ${password} Submit Credentials Login Should Have Failed ! Login Should Have Failed Location Should Be ${ERROR URL} Title Should Be Error Page
  • def open_browser(self, url, browser=b, alias=a): return self._cache.register(browser, alias) open_browser(‘http://localhost:7272/’) Open Browser http://localhost:7272/ function keyword
  • *** Keywords *** Login With Invalid Credentials Should Fail [Arguments] ${username} ${password} Input Username ${username} Input Password ${password} Submit Credentials Login Should Have Failed ! Login Should Have Failed Location Should Be ${ERROR URL} Title Should Be Error Page Nested!
  • THE LIBRARIES OperatingSystem Screenshot Telnet String Remote Process AndroidLibrary iOSLibrary DatabaseLibrary HTTPLibrary Selenium2Library SSHLibrary
  • THE TOOLS Rebot Testdoc Libdoc Sublime plugin Vim plugin Jenkins plugin
  • Pros & Cons • 優點 • 簡單易⽤用好上⼿手 • ⾃自動產出精美圖表 • 缺點 • 對測試撰寫⼈人員要求較⾼高 • 空格可能會讓新⼿手產⽣生困惑
  • More…
  • Thank you!