Tuesday, August 28, 2012

Robot Framework

Robot Framework is a generic open-source test automation framework for ATDD (Acceptance Test-Driven Development). It utilizes keyword driven testing approach, so even without any scripting knowledge you are able to write test scripts.

There are many different testing libraries / plugins available for Robot Framework e.g. Selenium / Watir / Watin libraries, Java GUI library, AutoIt library for testing Windows applications, Database libraries for testing databases, HTTP and SSH libraries, Jenkins plugin .. You can also create your own libraries in Java or Python.

Robot Framework has very good built-in logging and reporting functionalities with automatic screenshots.




Test scripts can be created using keyword-driven, data-driven or behavior-driven approach. The format of the test scripts can be HTML tables, tab separated values (TSV), plain text ... You can also create your own keywords, by using existing keywords. There is a test script editor available for Robot Framework called Ride.

Robot Framework development is supported by Nokia Siemens Networks.

Below I will describe how to install and use Robot Framework Selenium2Library with plain text scripts.


Installation

  1. Download Python 2.7 installer from http://www.python.org and run it.
  2. Add Python root and Scripts folders to PATH.
  3. Download Robot Framework installer from http://www.robotframework.org and run it. If you have problems with the installer (as I did), then download Robot Framework source and install it using command: python setup.py install
  4. Download Robot Framework Selenium2Library installer or source from https://github.com/rtomac/robotframework-selenium2library and install it in the same way as Robot Framework.

How to run scripts

By running following command:
pybot <scriptname>.html|txt|tsv


Example script - robottest.txt    
  

*** Settings ***
Documentation  A test suite for Google search.
Resource       robotresource.txt

*** Test Cases ***
Valid Search   
  Open Browser to Google Page 
  Input Query    Robot Framework   
  Submit Query    
  Check link to Robot Framework 
   [Teardown]  Close Browser


Example script - robotresource.txt


*** Settings ***
application.Library        Selenium2Library

*** Variables ***
${BROWSER}        firefox
${DELAY}          0

*** Keywords ***
Open Browser to Google Page   
  Open Browser  http://www.google.com ${BROWSER}   
  Maximize Browser Window   
  Set Selenium Speed  ${DELAY}

Input Query [Arguments]  ${query}   
  Input Text  q  ${query}

Submit Query  
  Click Button  gbqfb
 
Check link to Robot Framework 
  Wait Until Page Contains  Robot Framework  10


More information

https://github.com/robotframework/RIDE


1 comment: