KEMBAR78
Introduction to Robot Framework | PDF
by Siam Chamnan Kit Co., Ltd. and Odd-e (Thailand) Co, Ltd.
SPRINT3R
Acceptance Test
and
Acceptance-Test
Driven Development
with Robot Framework
1
Introduction
• Test automation framework
• For acceptance testing (ATDD)
• https://code.google.com/p/robotframework/
• Keyword-Driven Development
• Based on Python
• Open source
• Sponsor by Nokia Siemens Networks
2
ATDD Cycle
3
Architecture
4
Installation
• Python 2.7/2.8
• pip
• Robot Framework
• Selenium for Robot Framework
5
Install python (1)
• Download from https://www.python.org/
• Version 2.7/2.8
• $python
6
Install python (2)
• For Windows OS!
• set PYTHON_HOME=c:python27
• set PATH=.;%PYTHON_HOME%;%PATH%
7
Install python (3)
• Go to My Computer -> Right Click -> Properties
• Choose tab Advanced
8
Install python (4)
• Add Environment Variable
• PYTHON_HOME
9
Install python (5)
• Update Environment Variable in System
• PATH
10
Install pip (1)
• PIP = Package Installation for Python
• http://www.pip-installer.org/en/latest/installing.html
• Download file get-pip.py
• $python get-pip.py
11
Install pip (2)
• For Windows OS!
• set PYTHON_HOME=c:python27
• set PATH=.;%PYTHON_HOME%;%PYTHON_HOME%scripts;
%PATH%
• Test pip
• $pip
12
Install pip (3)
• For Mac OS!
• $easy_install pip
• $pip
13
PIP with Proxy
• SET HTTP_PROXY=<proxyHost>:<proxyPort>
• SET HTTPS_PROXY=<proxyHost>:<proxyPort>



14
• pip install --proxy="user:password@server:port"
packagename
Install Robot Framework
• $pip install robotframework
• $pybot

15
Install Selenium
• $pip install robotframework-selenium2library
https://code.google.com/p/robotframework-seleniumlibrary/16
Additional
• Text Editor => Sublime 2
• RIDE
• https://code.google.com/p/robotframework-ride/
17
Sublime Config
• Install Package Control
• https://sublime.wbond.net/installation
18
Sublime Config
• Install Robot Framework plug-in
• Tools -> Command Palette …
• Package control : Install Package
• Find Robot Framework
19
Sublime …
20
Test Structure
21
Standard Libraries
• Build in!
• Operating System!
• Screenshot
• Telnet
• String
• Collections!
• Remote
• Dialog
• XML
• Process
http://robotframework.org/#test-libraries
External Libraries
• Selenium2Library!
• Android
• iOS
• Database
• FTP
• HTTP
• MongoDB
• SSH
• AutoItLibrary
• Swing
http://robotframework.org/#test-libraries
Selenium Keyword
• Open Browser <url> <browser>
• Input Text <locator> <value>
• Click Button <locator>
• Click Link <locator>
• Close Browser
24
Selenium Keyword
• Wait Until Page Contains <text>
• Page Should Contain <text>
• Title Should Be <text>
25
More
26
http://rtomac.github.io/robotframework-selenium2library/doc/Selenium2Library.html
Hello Robot
• Create file hello.txt
• Run with
• $pybot hello.txt
27
Be careful
• Page Should Contain Google
4 spacebars
only 1 spacebar
28
Report
29
Report
30
Solve Proxy Problem
• For Firefox on Windows OS!
• Using Firefox profile
• $c:Program FilesMoxilla Firefoxfirefox.exe -P
31
Solve Proxy Problem
• For Firefox on Mac OS!
• Using FireFox profile
• $/Applications/Firefox.app/Contents/MacOS/firefox-bin -profilemanager
32
Solve Proxy Problem
• For Firefox on Linux!
• Using FireFox profile
• $./firefox -profilemanager
33
Solve Proxy Problem
• Create Profile …
34
Config Proxy in Firefox
• Start FireFox with my profile
• Configuration Proxy server in
• Preferences -> Advanced -> Network
35
Workshop
• Create test case with Robot Framework
• Test www.google.com
36
Search with Google
37
Workshop
• Create test case with Robot Framework
• Demo Login
38
Support Multiple Browser
• Google Chrome
• Internet Explorer
39
Google Chrome (1)
• Download Chrome Driver
• https://code.google.com/p/selenium/wiki/ChromeDriver
40
Google Chrome (2)
http://robotframework.googlecode.com/svn/trunk/doc/libraries/OperatingSystem.html#Set Environment Variable41
Internet Explorer (1)
• Download Internet Explorer Driver
• https://code.google.com/p/selenium/wiki/InternetExplorerDriver
42
Internet Explorer (2)
http://robotframework.googlecode.com/svn/trunk/doc/libraries/OperatingSystem.html#Set Environment Variable43
Workshop
• Create test case with Robot Framework
• TODO Application
• http://up1todo.appspot.com/
44
Question ?
45

Introduction to Robot Framework