Robot Framework

41
ROBOT FRAMEWORK Onur Baskirt

Transcript of Robot Framework

Page 1: Robot Framework

ROBOT FRAMEWORKOnur Baskirt

Page 2: Robot Framework

Who am I?▪ I am Onur Başkırt

▪ Currently, Head of SW Testing at Kariyer.net

▪ Co-owner of www.swtestacademy.com and a Test Hive Member

▪ Formerly, Teknosa, Ericsson, Huawei, ST-Ericsson, Bahçeşehir University

Page 3: Robot Framework

Table of Contents

▪ What is Robot Framework?

▪ Robot Framework Architecture and Test Flow

▪ Libraries

▪ Tools

▪ How to install Robot Framework on Windows?

▪ Robot Framework Usage with an Example

Page 4: Robot Framework

What is Robot Framework?▪ Robot Framework is a generic test automation framework.

▪ It has easy-to-use tabular test data syntax.

▪ It utilizes the keyword-driven testing approach.

▪ Its testing capabilities can be extended by test libraries.

▪ Users can create new higher-level keywords from existing ones using the same syntax.

▪ It is operating system and application independent. The core framework is implemented using Python.

▪ Robot Framework itself is open source.

Page 5: Robot Framework

Robot Framework Architecture and Test Flow▪ When test execution is started, the framework

first parses the test data.

▪ It then utilizes keywords provided by the test libraries to interact with the system under test.

▪ Libraries can communicate with the system either directly or using other test tools as drivers.

▪ Test execution is started from the command line and at the end of execution you get report and log HTML format as well as XML output.

Page 6: Robot Framework

Libraries▪ Test libraries provide the actual testing capabilities to Robot Framework by

providing keywords.

Page 7: Robot Framework

Libraries

Page 8: Robot Framework

Libraries

Page 9: Robot Framework

Tools

Page 10: Robot Framework

Tools

Page 11: Robot Framework

Tools

Page 12: Robot Framework

How to install Robot Framework on Windows?▪ We will install Robot Framework with pip.

▪ Pip is the standard Python package manager and is already installed if you’re using Python 2 >=2.7.9 or Python 3 >=3.4

Page 13: Robot Framework

How to install Robot Framework on Windows?▪ Step-1: Install Phyton

Go to https://www.python.org/ , download and install Python 2.7.x version

Page 14: Robot Framework

How to install Robot Framework on Windows?▪ Step-2: Install Robot Framework

Open command prompt and run below command.

pip install robotframework

Page 15: Robot Framework

How to install Robot Framework on Windows?▪ Step-3: Upgrade pip

Upgrade the pip with below command.

python -m pip install -U pip

Page 16: Robot Framework

How to install Robot Framework on Windows?▪ Step-4: Verifying Installation

After a successful installation, you should be able to execute below commands and get both Robot Framework and interpreter versions.

robot --version

rebot --version

Page 17: Robot Framework

How to install Robot Framework on Windows?▪ Note: If you have any problem please check Path configuration and restart

your PC. Path configuration must be as same as below figure.

Page 18: Robot Framework

How to install Robot Framework on Windows?▪ Step-5: Upgrade Robot Framework

Upgrading to a new version required either using the –upgrade option:

pip install --upgrade robotframework

or specifying the version to use explicitly:

pip install robotframework==2.9.2

Note: You can uninstall Robot Framework anytime with below command.

pip uninstall robotframework

Page 19: Robot Framework

How to install Robot Framework on Windows?▪ Step-6: Installing RIDE (Robot Framework Test Data Editor)

▪ Python 2.6 is the minimum version.

▪ Notice that similarly as Robot Framework, RIDE does not yet support Python 3.

▪ Notice also that on OS X RIDE requires 32-bit Python version.

Page 20: Robot Framework

How to install Robot Framework on Windows?▪ Step-6: Installing RIDE (Robot Framework Test Data Editor)

▪ Step-6.1: Python must be installed. (We installed it)

Page 21: Robot Framework

How to install Robot Framework on Windows?▪ Step-6: Installing RIDE (Robot Framework Test Data Editor)

▪ Step-6.2: wxPyhton must be installed.

We need to install “wxPyhton2.8-win32-unicode-2.8.12.1-py27.exe” 32-bit version.

WARNING!If you install latest version, you will get below error!

Page 22: Robot Framework

How to install Robot Framework on Windows?▪ Step-6: Installing RIDE (Robot Framework Test Data Editor)

▪ Step-6.3: Install RIDE with below pip command

pip install robotframework-ride

Page 23: Robot Framework

How to install Robot Framework on Windows?▪ Step-6: Installing RIDE (Robot Framework Test Data Editor)

▪ Step-6.4: After a successful installation, RIDE can be started from the command line by running ride.py.

Page 24: Robot Framework

How to install Robot Framework on Windows?▪ Step-7: Install Selenium 2 (WebDriver) Library

Selenium2Library is a web testing library for Robot Framework that leverages the Selenium 2 (WebDriver) libraries from the Selenium project.

Installation Command:

pip install robotframework-selenium2library

Page 25: Robot Framework

How to install Robot Framework on Windows?▪ Step-8: Upgrade Selenium 2 (WebDriver) Library

Upgrade Command:

pip install --upgrade robotframework-selenium2library

Page 26: Robot Framework

Robot Framework Usage with an Example▪ Test Scenario:

▪ Open www.kariyer.net

▪ Check Title

▪ Maximize Browser

▪ Go to User Login Page

▪ Enter User Name

▪ Enter Wrong Password

▪ Click Login

▪ Wait 2 seconds

▪ Assert Warning Message

▪ Close Browser

Page 27: Robot Framework

Robot Framework Usage with an Example▪ Directory Structure:

▪ setup.robot file holds Settings, Variables, Keywords information

▪ KariyerLoginTest.robot file contains Test Cases which are using our High Level Keywords

Page 28: Robot Framework

Robot Framework Usage with an Example▪ Setup.robot:

▪ KariyerLoginTest.robot:

setup.robot

KariyerLoginTest.robot

Page 29: Robot Framework

Robot Framework Usage with an Example▪ Run the Test on Command Prompt robot KariyerLoginTest.robot

▪ Report and log results will be automatically generated after the test execution.

Page 30: Robot Framework

Robot Framework Usage with an Example▪ Run the Test on RIDE▪ Open cmd prompt and write “ride.py” and then press Enter. Then, you will see

RIDE editor.

▪ Go to File >> New Project and then give a name to your project as shown below.

Page 31: Robot Framework

Robot Framework Usage with an Example▪ Add Resource File

Page 32: Robot Framework

Robot Framework Usage with an Example▪ After adding Resource File

Page 33: Robot Framework

Robot Framework Usage with an Example▪ Write your robot test

Page 34: Robot Framework

Robot Framework Usage with an Example▪ Write your robot test

Page 35: Robot Framework

Robot Framework Usage with an Example▪ Run The Test

Page 36: Robot Framework

Robot Framework Usage with an Example▪ While Test is Running

Page 37: Robot Framework

Robot Framework Usage with an Example▪ When Test finished.

Page 38: Robot Framework

Robot Framework Usage with an Example▪ REPORT

Page 39: Robot Framework

Robot Framework Usage with an Example▪ LOG

Page 40: Robot Framework

For More Information▪ http://www.swtestacademy.com/getting-started-robotframework/

Page 41: Robot Framework

QUESTIONS?