In this tutorial, we will create an empty Robot Framework script that will later be used for test automation.
Robot Framework scripts are plain text files with the extension .robot.
Each robot framework file contains a suite that can contain Tests or Tasks.
What are the sections in Robot Framework?
Each file needs predefined sections; examples of Robot Framework sections are listed below:
- Setting
- Keywords
- Test Cases
How do you define a section in a .robot file?
The sections in a Robot Framework script are defined using a specific convention.
The Robot Framework Language Server makes our lives easier by helping us do the right things in the correct format.
To see a practical example, Let's open the Visual Studio Code.
Let's click Open Folder and select a folder to store our test automation or RPA Robot Framework scripts which we will create together in this course.
After opening a folder, let's create a new file to store our Robot framework automation script.
I'll call it Section1.robot
What is the structure of a section name in Robot Framework?
Now I'll click in the text editor and type a triple asterisk *** followed by the word settings.
Intellisense will help us do this easily.
*** Settings ***
A section in a robot file is defined by starting a new line with three asterisks, a whitespace, the section name, another whitespace, and three asterisks at the end of the line.
***[space]<section name>[space]***[newline]
I'll press enter and repeat the same process for more sections, like Keywords and Test Cases.
We can also have a Variables section, but I'll explain it in the post in this series[link].
Now save the file by pressing Ctrl + S. I'll call it first-script.robot
(the file extension of robot script files is .robot)
This is an empty script. But still, we can use it to find whether we've done everything correctly so far.
To run this empty script, we will click the terminal menu item and select "New Terminal."
Over here, let's type robot space Section1, press the tab, and enter.
The Robot Framework will tell you that the test suite defined in this file does not contain tests or tasks.
Don't worry; we'll fill the empty sections later.
For now, we have set up Robot Framework correctly and have already created an empty shell suite file for our use.
Next post in this series >> Next