Tuesday, April 7, 2015

Robotframework - Parallel test execution of two different testsuites on two different machines.

Robotframework - Parallel test execution of two different testsuites on two different machines.





Step 1:
Install the selenium server "http://docs.seleniumhq.org/download/" from the location.

Filename -  selenium-server-standalone-3.8.1.jar (Version will be different in your case)

Step 2:
From Machine1 command prompt, Go to the jar application location and launch it as 'hub' by giving commmand

java -jar selenium-server-standalone-3.8.1.jar -role hub

Step 3:
From Machine2 command prompt, Go to the jar application location and launch it as 'node' by giving command

java -jar selenium-server-standalone-3.8.1.jar -role node -hub http://<Machine 1 IP address>:4444/grid/register -port 5566

Test cases:

Open Browser    ${URL}    ${BROWSER}    None    http://<HUB Machine IP ADDRESS>:5566/wd/hub

Sunday, April 5, 2015

Robotframework: Customized library using python - How to

Robotframework: How to create a customized library using python to create a robot keyword

Below example shows the creating a robot keyword "Addition" using customized library

Step 1. Create the python script,

Addition.py - (Library name to be imported in RF)
-------------

from robot.api import logger
from robot.libraries.BuiltIn import BuiltIn


def add_two_numbers(number1, number2):
    """ Python function for adding two numbers """
    return int(number1) + int(number2)



add_two_numbers - Keyword to be used in test scripts

Step 2: Save the file in the folder "C:\Python27\Lib\site-packages"

Step 3: Robot test scripts

Filename - Addition.txt
Execution command - pybot Addition.txt


*** Settings ***
Documentation     Testing my own library

Library    Addition

*** Test Cases ***
Add two
    Add two numbers using own library


***Keywords***
Add two numbers using own library
    ${ADDITION}    Add two numbers    1    8
    Log to console    ${ADDITION}

 Execution Report