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


Robotframework: AutoIt Library installation steps

Robot Framework: AutoIT library installation steps

Step 1: Install python 2.7 (64 or 32 bit, based on the machine) and you can verify it by typing python in command prompt. you can see the version in the top of the console.
           

Step 2: Install robotframework using pip command: "pip install robotframework" and you can verify it by command "pybot --version"



Step 3: Install pywinauto (32 or 64 bit, based on the python version which you installed) and you can verify by importing the pywin module in the python or Install wxpython for corresponding python version.



Step 4: Install robotframework AutoIT library by downloading the package and install the setup.py file using the command "python setup.py install"

Note: To install AutoIT library, launch the command prompt in administrator mode.

Once the installation is successful, AutoIT library folder will be created in the location

"C:\RobotFramework\Extensions"

Note: Its better to install 32 bit windows of Python, pywin or Wxpython to avoid problems.