introduction to robot framework

Download Introduction to Robot Framework

Post on 19-Aug-2014

766 views

Category:

Engineering

3 download

Embed Size (px)

DESCRIPTION

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.

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 cong 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 les) 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!