introduction to robot framework

45
by Siam Chamnan Kit Co., Ltd. and Odd-e (Thailand) Co, Ltd. SPRINT3R Acceptance Test and Acceptance-Test Driven Development with Robot Framework 1

Upload: somkiat-puisungnoen

Post on 06-May-2015

2.537 views

Category:

Technology


8 download

DESCRIPTION

Introduction to Robot Framework

TRANSCRIPT

Page 1: Introduction to Robot Framework

by Siam Chamnan Kit Co., Ltd. and Odd-e (Thailand) Co, Ltd.SPRINT3R

Acceptance Test and

Acceptance-Test Driven Development

with Robot Framework

1

Page 2: Introduction to Robot Framework

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

Page 3: Introduction to Robot Framework

ATDD Cycle

3

Page 4: Introduction to Robot Framework

Architecture

4

Page 5: Introduction to Robot Framework

Installation• Python 2.7/2.8

• pip

• Robot Framework

• Selenium for Robot Framework

5

Page 6: Introduction to Robot Framework

Install python (1)• Download from https://www.python.org/

• Version 2.7/2.8

• $python

6

Page 7: Introduction to Robot Framework

Install python (2)

• For Windows OS!

• set PYTHON_HOME=c:\python27

• set PATH=.;%PYTHON_HOME%;%PATH%

7

Page 8: Introduction to Robot Framework

Install python (3)• Go to My Computer -> Right Click -> Properties

• Choose tab Advanced

8

Page 9: Introduction to Robot Framework

Install python (4)• Add Environment Variable

• PYTHON_HOME

9

Page 10: Introduction to Robot Framework

Install python (5)• Update Environment Variable in System

• PATH

10

Page 11: Introduction to Robot Framework

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

Page 12: Introduction to Robot Framework

Install pip (2)• For Windows OS!

• set PYTHON_HOME=c:\python27

• set PATH=.;%PYTHON_HOME%;%PYTHON_HOME%\scripts;%PATH%

• Test pip

• $pip

12

Page 13: Introduction to Robot Framework

Install pip (3)

• For Mac OS!

• $easy_install pip

• $pip

13

Page 14: Introduction to Robot Framework

PIP with Proxy• SET HTTP_PROXY=<proxyHost>:<proxyPort>

• SET HTTPS_PROXY=<proxyHost>:<proxyPort>

14

• pip install --proxy="user:password@server:port" packagename

Page 15: Introduction to Robot Framework

Install Robot Framework• $pip install robotframework

• $pybot

15

Page 16: Introduction to Robot Framework

Install Selenium• $pip install robotframework-selenium2library

https://code.google.com/p/robotframework-seleniumlibrary/16

Page 17: Introduction to Robot Framework

Additional• Text Editor => Sublime 2

• RIDE

• https://code.google.com/p/robotframework-ride/

17

Page 18: Introduction to Robot Framework

Sublime Config• Install Package Control

• https://sublime.wbond.net/installation

18

Page 19: Introduction to Robot Framework

Sublime Config• Install Robot Framework plug-in

• Tools -> Command Palette …

• Package control : Install Package

• Find Robot Framework

19

Page 20: Introduction to Robot Framework

Sublime …

20

Page 21: Introduction to Robot Framework

Test Structure

21

Page 22: Introduction to Robot Framework

Standard Libraries• Build in!

• Operating System!

• Screenshot

• Telnet

• String

• Collections!

• Remote

• Dialog

• XML

• Process

http://robotframework.org/#test-libraries

Page 23: Introduction to Robot Framework

External Libraries• Selenium2Library!

• Android

• iOS

• Database

• FTP

• HTTP

• MongoDB

• SSH

• AutoItLibrary

• Swing

http://robotframework.org/#test-libraries

Page 24: Introduction to Robot Framework

Selenium Keyword• Open Browser <url> <browser>

• Input Text <locator> <value>

• Click Button <locator>

• Click Link <locator>

• Close Browser

24

Page 25: Introduction to Robot Framework

Selenium Keyword• Wait Until Page Contains <text>

• Page Should Contain <text>

• Title Should Be <text>

25

Page 26: Introduction to Robot Framework

More

26

http://rtomac.github.io/robotframework-selenium2library/doc/Selenium2Library.html

Page 27: Introduction to Robot Framework

Hello Robot• Create file hello.txt

• Run with

• $pybot hello.txt

27

Page 28: Introduction to Robot Framework

Be careful

• Page Should Contain Google

4 spacebars

only 1 spacebar

28

Page 29: Introduction to Robot Framework

Report

29

Page 30: Introduction to Robot Framework

Report

30

Page 31: Introduction to Robot Framework

Solve Proxy Problem• For Firefox on Windows OS!

• Using Firefox profile

• $c:\Program Files\Moxilla Firefox\firefox.exe -P

31

Page 32: Introduction to Robot Framework

Solve Proxy Problem• For Firefox on Mac OS!

• Using FireFox profile

• $/Applications/Firefox.app/Contents/MacOS/firefox-bin -profilemanager

32

Page 33: Introduction to Robot Framework

Solve Proxy Problem• For Firefox on Linux!

• Using FireFox profile

• $./firefox -profilemanager

33

Page 34: Introduction to Robot Framework

Solve Proxy Problem• Create Profile …

34

Page 35: Introduction to Robot Framework

Config Proxy in Firefox• Start FireFox with my profile

• Configuration Proxy server in

• Preferences -> Advanced -> Network

35

Page 36: Introduction to Robot Framework

Workshop• Create test case with Robot Framework

• Test www.google.com

36

Page 37: Introduction to Robot Framework

Search with Google

37

Page 38: Introduction to Robot Framework

Workshop• Create test case with Robot Framework

• Demo Login

38

Page 39: Introduction to Robot Framework

Support Multiple Browser• Google Chrome

• Internet Explorer

39

Page 40: Introduction to Robot Framework

Google Chrome (1)• Download Chrome Driver

• https://code.google.com/p/selenium/wiki/ChromeDriver

40

Page 41: Introduction to Robot Framework

Google Chrome (2)

http://robotframework.googlecode.com/svn/trunk/doc/libraries/OperatingSystem.html#Set Environment Variable41

Page 42: Introduction to Robot Framework

Internet Explorer (1)• Download Internet Explorer Driver

• https://code.google.com/p/selenium/wiki/InternetExplorerDriver

42

Page 43: Introduction to Robot Framework

Internet Explorer (2)

http://robotframework.googlecode.com/svn/trunk/doc/libraries/OperatingSystem.html#Set Environment Variable43

Page 44: Introduction to Robot Framework

Workshop• Create test case with Robot Framework

• TODO Application

• http://up1todo.appspot.com/

44

Page 45: Introduction to Robot Framework

Question ?

45