Dummy codes

Supported File Formats for Robot Framework

The Robot framework test data can be defined in two different formats

Plain Text Format in Robot Framework

The plain text format is the base for all supported robot framework data formats. It can be edit by using the normal text editor and IDE's. Test Data can be parsed line by line. In single-line arguments and keywords are separated by a separator.

The most commonly used separator is space separator

Space separator : Two or more spaces acts as a separator between the two different data items. The minimum spaces should be two.

Let us see how to write the test cases in plain text format. Open the Ride editor and then click on any test case, here I am opening the First Test case.

You can see the three options Edit, Text Edit, and Run, click on the Text Edit to write the test case in the plain text format.

text-editor-for-pzlin-text

Create another test case in the plain text format as the Fourth test case and selected the keyword as Should Be Equal and pass the arguments as 4 and 4 by giving the two spaces between them.

created-fourth-test-case0in-the-plain-text

We entered the test case in the text editor, and the same will be reflected in the Editor as well.

plain-text-reflecting-in-the-editor

Keyword Rewind Functionality

Tab Separated Format(TSV)

The files in the TSV format are typically edited in the spreadsheet programs because the syntax is so simple, and they are easy to generate programmatically. They are pretty easy to edit by using the normal editor, and also they work well in version control.

In the case of Plain text format, we will use the spaces to separate the arguments, but in the case of TSV, we use tabs to separate the arguments.

We can create and edit the TSV files in any spreadsheet program, such as Microsoft Excel. The TSV file containing non-ASCII characters must be saved using UTF-8 encoding.

The files in the TSV format are commonly saved by using the .tsv extension. But starting from the framework 3.1, the --extension is used explicitly to tell that these files should be parsed. We can also save the TSV files with .robot extension, but this requires the files to be fully compatible with the plain text syntax.

The supported text formats are:

reStructured Text format: it is easy to read plain text markup syntax that is commonly used for documentation of python projects.

The reStructured documents are most often compiled to HTML, but still, other output formats are supported.

Robot Framework Built-in Library

Robot Framework Collections

Robot framework collection is a test library which provides the set of keywords for handling Python List and dictionary variables. collections having keywords for modifying and getting values from the list and the dictionaries and verifying the contents of List and dictionaries.

Following are the Built-in Library Keywords

Keyword Name Applicable With
Create List List
Get Length Both
Length Should be Both
Should be empty Both
Should Not be empty Both
should contain List List
Should not contain List
Should Contain X times List
Should Not Contain X times List
Get Count List
All the List variable except scalar ${List} variable has an argument.
It is possible to use List variable @{List} as a scalar variable ${List} by replacing @ by $

For Complete List and dictionary keywords visit link Collection keywords

End to End Automation of Flight Application

Robot Framework Yaml Variable

YAML Ain't Markup Language is a data serialization language that matches user’s expectations about data. It is designed to be human-friendly and works perfectly with other programming languages. It is useful to manage data and includes Unicode printable characters.

Example: Consider the text as shown below:

Quick brown fox jumped over the lazy dog'

In the YAML markup language, this will be represented as shown below

yaml.load(Quick brown fox jumped over the lazy dog.)
>>'Quick brown fox jumped over the lazy dog.'

The yaml takes the value in the string format and represents as shown above.

Suppose, multiple values are to be loaded in a specific data structure as mentioned below

eggs
ham
spam
French basil salmon terrine

When you load this into YAML, the values are taken in an array data structure which is a form of a list. The output is as shown below

>>> yaml.load('''
   - eggs
   - ham
   - spam
   - French basil salmon terrine
   ''')
['eggs', 'ham', 'spam', 'French basil salmon terrine']
The Features of YAML are as follow:
  • Matches native data structures of agile methodology and its languages such as Perl, Python, PHP, Ruby, and JavaScript
  • YAML data is portable between programming languages
  • Includes data consistent data model
  • Easily readable by humans
  • Supports one-direction processing
  • Ease of implementation and usage

Manages Booking Test Scenarios

Installation of YAML Library

To read the YAML files in the python we have to install the YAML library into python so that we can use them as per our needs. The easiest way to install the YAML library in Python is via the pip package manager. If you have pip installed in your system, run the following command to download and install YAML:

pip install robotframework-yamllibrary

successfully-installed-yaml-library

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions

Subscribe to See Videos

Subscribe to my Youtube channel for new videos : Subscribe Now