Book Image

Robot Framework Test Automation

By : Sumit Bisht
Book Image

Robot Framework Test Automation

By: Sumit Bisht

Overview of this book

Testing has traditionally been a part of software development, and has always involved a lot of manual effort. It can be automated with Robot Framework, which offers numerous benefits from cost saving to increased quality assurance in the software delivery. This book will help you to start designing test suites and Automated Acceptance Tests. Helping you to get started with automating acceptance tests, this book will provide a detailed overview of acceptance test management practices and principles. You will also be introduced to advanced techniques that you can use to customize the test suite, along with helpful tips and tricks to extend and leverage it in a wide variety of scenarios. Starting with a detailed explanation of the need for automated acceptance test driven development, this guide will help you with an empty test project creation and execution for proof of concept, and validation of installation. This book will also cover the Robot Framework in detail, and will help you test desktop applications using Java Swing. You will gain an in-depth knowledge of tricky activities, such as setting up a test environment and using it with Selenium. You will also learn about other popular libraries, and how to test network protocols, web services, and databases. This book will cover the entire Robot Framework with real- world practical material to make its content informative and interesting. By the end of this book you will be able to write acceptance tests for desktop and web applications, as well as know how to extend acceptance testing in other scenarios that are commonly devoid of tests, and present the results appropriately.
Table of Contents (12 chapters)

Support for different runtimes

The Robot Framework not only works on the native python (CPython/pypy installations ), but also supports Java and .NET based runtimes in the form of Jython and ironpython respectively. While there are some features that are exclusive to native Python-or Jython-based Robot Framework installations, most of the functionality is equivalent on all the runtimes. As people might have different OS and application software a stack setup according to their needs or desires, so they can integrate this tool in their existing runtime without requiring a separate runtime.

Based upon the installer environment used, the Robot Framework will create appropriate startup and post-processing scripts:


Startup command

Post-processing command







Iron Python



In addition to these commands used in starting the execution, the Robot Framework can directly be started through the module itself if the standard Robot Framework is installed. This can also be used instead of the standard commands as the commands also call the module internally. The module can be called if the Python command in use is the one that has the Robot Framework installed:

python -m
jython .../
ipy -m

This is handy if the Robot Framework is called by some the Python script. Instead of executing the scripts separately, you can call the framework from inside the same program easily.

The post processing command is useful to recreate test executions in the long run. After the test has been executed, you can save the XML file generated as output without saving any other file. To recreate the report and log files again in future, the rebot command can be used which takes the XML file as an argument and results in the generation of the log and report files without recalling or running the actual tests again.

Command details

The Pybot command provides the following major options:



-N --name <name>

Sets the name of topmost test suite in the test hierarchy—thereby effectively customizes those areas.

-D --doc <documentation>

Sets the documentation of the top level test suite.

-M --metadata [name:value]

Sets the metadata of the top level test suite.

-G --settag <tagname>

Sets the given tag to all executed test cases.

-t --test name

Selects the test cases available by performing a pattern match against them.

-s --suite name

Selects the specified test suite by its name and also allows for the test reports to have the desired name instead of the name picked up by file/folder name.

-i --include tag

Selects a test for execution on the basis of its tag name.

-e --exclude tag

Opposite of include tag.

-R --runfailed output

Selected failed tests of earlier test runs have another goal.

-c --critical tag

Tests having this tag are considered critical (default for all tests).

-n --noncritical tag

Tests having this tag are overridden to be of non-critical type.

-v --variable name:value

Set variables in tests, only scalar variables(${}) are supported.

-V --variablefile path

Specify explicitly the file that contains variables.

-d --output dir

Specify the desired directory where resultant files are placed.

-o --output file

The generated XML output file.

-l --log file

The generated HTML log file.

-r --report file

The generated HTML log file.

-x --xunit file

xUnit compatible result file (not created by default).

-b --debugginge rake

Debug file written during the execution(not created by default).

-T --timestampoutputs

Adds timestamp and provides a custom title to all output files.

-L --Loglevel

Threshold level for logging and logging and test order customization.

-W --monitorwidth

Specify the width of monitor output.

-C --monitotcolors

Specify whether to use color on console or not.

-K --monitormarkers

Specify test success on console for each test that passes.

-P --pythonpath path

Additional locations to search test libraries from.

-E -escape what

Specify escape characters in console with common representation.

-A --argumentfile path

Specify a text file to read more arguments in tests.

-h -? --help

Prints detailed help for the command.


Prints the version of the installed Robot Framework.