In this tutorial I will help you to write a simple program in Robot Test Framework. As usual we will start with installation.
For Robot to work we need Python, Jython, WxPython to be installed on the machine. So lets first install them before we do anything else.
Python InstallationStep 1: Download Python for Windows from http://www.python.org/getit/windows/ and doubleclick on the installer
Step 2: Complete the installation
Step 3: Put Python bin directory in the environment Variable PATH
Step 4: Verify the installation by typing 'python' on your command prompt
Jython InstallationUsing test libraries implemented with Java or using Java tools internally requires running Robot Framework on Jython, which in turn requires Java Runtime Environment (JRE).
Installing Jython is a fairly easy procedure, and the first step is getting an installer from http://jython.org. The installer is an executable JAR package, which you can run from the command line like java -jar jython_installer-<version>.jar.
Depending on the system configuration, it may also be possible to just double-click the installer.
Step 1: Download Jython for Windows from http://jython.org/downloads.html and on command prompt type 'java -jar jython_installer-<version>.jar' where <version> needs to be replaced by the actual version
Step 2: Complete the installation process
Robot InstallationStep 1: Download Robot for Windows from http://downloads.robotframework.org/ and double click on the installer
Step 2: Complete the installation process
WxPython InstallationStep 1: Download WxPython for Windows from http://wxpython.org/download.php#stable and double click on the installer
Robot-RIDE InstallationStep 1: Download Robot-RIDE for Windows from https://github.com/robotframework/RIDE/downloads/ and double click on the installer
Step 2: On command prompt go to scripts directory where python is installed <PYTHON_INSTALLED_DIR>\scripts and type 'ride.pyc'. You will see following screen where you can write your Test cases
Writing simple Test Case in Robot-RIDELet us write a Test Case to check whether a particular directory exists or not on our machine.
From file menu select new project give it some name like Example. Now right click on this project and select New Test Case. Give it some name like My Test. Also right click on project and select New User Keyword and give a name like My Keyword.
There are some libraries which are by default provided by Robot like OperatingSystem which provides functionality of some operating system keywords like File operations, directory operations, etc...
So we first import this library in the Project Page. Also Add Scalars for all variables you need to use in your Tests like path and MESSAGE in this case.
In the Test Case page, write your test case like <keyword> and <arg1> <arg2> .... In this case Log and My Keyword are keywords and ${MESSAGE} and ${path} are args.
Where My Keyword is a keyword created by user by adding some available keywords from library as show below. In this case we are using Directory Should Exist keyword and argument as ${path}.
Running Test Case in Robot-RIDESimply hit the Run button shown as "robot face" in the robot-RIDE screen.
Logs of Test Case in Robot-RIDEBelow is a sample log file
Reports in Robot-RIDEThis is a sample report in Robot-RIDE
We can also write our own libraries in Robot using either Java or Python. We will look into it in later posts.
~Yagnanarayana Dande
No comments:
Post a Comment