Sunday 9 August 2015

Basic of Robot Framework Part 1


This is very useful blog to understand about Robot F/W. I have taken reference of mostly all popular Robot Framework site like http://robotframework.org/ , https://en.wikipedia.org/wiki/Robot_Framework etc.

What is Robot Framework?
  • Robot Framework is a generic test automation framework for acceptance testing and acceptance test-driven development (ATDD).
  • Has easy-to-use tabular test data syntax and it utilizes the keyword-driven testing approach.
  • Was originally developed in 2005 and used within NokiaSiemensNetworks (NSN) as an internal tool. In Spring 2008 was published as an OpenSource project and since then hosted on GoogleCode.
  • Lately has become very popular tool, has constantly growing users community as well as RF external libraries and tools developers community.
  • The framework has a rich ecosystem around it consisting of various generic test libraries and tools that are developed as separate projects.
Features of Robot Framework
  • Keyword-driven
  • Easy-to-use, tabular syntax
  • Python-based (works on Windows, Linux and Mac)
  • Extendable by Java and Python libraries
  • Excellent easy to read reports and logs in HTML and XML format
  • Supports CLI (command line interface) and GUI web browser testing
  • Remote testing by Telnet and SSH
  • Supports Data-Driven and BDD (Behavior Driven Development) Style Tests
  • Provides tagging to categorize tests
 
Test Data Syntax
  • Files and Directories
    • Test cases are created in test case files.
    • A test case file automatically creates a test suite containing the test cases in that file.
    • A directory containing test case files forms a higher-level test suite. Such a test suite directory has suites created from test case files as its sub test suites.
    • A test suite directory can also contain other test suite directories, and this hierarchical structure can be as deeply nested as needed.
    • Test suite directories can have a special initialization file.
  • In addition to this, there are:
    • Test libraries containing the lowest-level keywords.
    • Resource files with variables and higher-level user keywords.
    • Variable files to provide more flexible ways to create variables than resource files.
  • Supported File Formats
    • Robot Framework test data is defined in tabular format, using either hypertext markup language (HTML), tab-separated values (TSV), plain text, or reStructuredText (reST) formats. Which format to use depends on the context, but the plain text format is recommended if there are no special needs.
  • HTML format
    • In HTML files, the test data is defined in separate tables. This makes it possible to add additional information into test case files and allows creating test case files that look like formal test specifications.
  • TSV format
    • TSV files can be edited in spreadsheet programs and, because the syntax is so simple, they are easy to generate programmatically. In a TSV file, all the data is in one large table. Test data tables are recognized from one or more asterisks (*), followed by a normal table name and an optional closing asterisks.
  • Plain text format
    • Any text editor can be used. Technically similar to TSV format, but uses different cell separator.
    • Space separated format: the number of spaces used as separator can vary, as long as there are at least two spaces, and it is thus possible to align the data nicely. It is recommend to use four spaces between keywords and arguments.
    • Pipe and space separated format: can be used if keywords take a lot of arguments and/or arguments contain spaces.
    • A plain text file can contain test data in both space-only and space-and-pipe separated formats, but a single line must always use the same separator.
Test data tables
Test data is structured in four types of tables listed below. These test data tables are identified by the first cell of the table, and the last column in the table below lists different aliases that can be used as a table name.

Table name Used for Aliases
Setting table 1) Importing test libraries, resource files and variable files
2) Defining metadata for test suites and test cases
Setting, Settings, Metadata
Variable table Defining variables that can be used elsewhere in the test data Variable, Variables
Test case table Creating test cases from available keywords Test Case, Test Cases
Keyword table Creating user keywords from existing lower-level keywords Keyword, Keywords, User Keyword, User Keywords

Hope this is useful to start Robot F/W testing. I am going to write more about Robot F/W in coming days about best practices to write test cases.