Simple robot tutorial

Tutorial for creating a simple software robot with Robot Framework.

To learn the basics of Robot Framework, you are going to build a simple robot. This robot demonstrates some of the basic features of the Robot Framework. When run, the robot will greet you by printing a greeting to the terminal. In addition to learning some basic Robot Framework concepts, you will learn some good practices for setting up your robot project to make it easier to extend in the future.

This tutorial uses the word "terminal" when referring to terminal or command prompt.

Simple robot animation


Set up your development environment.

Initialize the software robot directory

Navigate to your projects directory in the terminal or the command prompt. Initialize the software robot directory:

robo init simple-robot

Navigate to the directory:

cd simple-robot

Robot task file

Paste the following Robot Framework code in the tasks/robot.robot file:

*** Tasks ***
    Log To Console    Hello!

Save the file.

Wrap the robot

robo wrap

Run the robot


robo run entrypoint.cmd

macOS / Linux:

robo run

The robot logs "Hello!" to console (terminal). In addition, the robot execution produces report and log files. These contain detailed information about the last execution. The Robot Framework User Guide contains detailed explanations of the files. On macOS, you can open the log.html in your default browser:

open temp/robocode/simple-robot/output/log.html

Robot script explained

*** Tasks ***
    Log To Console    Hello!

The first line tells the Robot Framework that there are tasks to run. The convention is to start with three asterisks (***), followed by Tasks and end with three asterisks. Robot Framework looks for this syntax to identify script sections.

The second line defines the name of the task (Greet). It is recommended to use descriptive names for the tasks.

The third line tells Robot Framework to log to console using the built-in Log To Console keyword (called a keyword, although it is technically a phrase :-)). Robot Framework knows the technical details of logging to console.

Hello! is provided as an argument to the Log To Console keyword. Think of the keyword as a function and the value following it as an argument for the function (log_to_console("Hello!")).

Important: You need to add indentation (add spaces) before the Log To Console keyword. The convention is to add four spaces, but two will work, too. You need to have more than one space between the Log To Console keyword and the Hello! argument.

Robot Framework syntax can be pretty similar to written English, depending on how the keywords are defined. Well-written keywords make the scripts readable and understandable even for someone without knowledge of Robot Framework syntax.


You executed your first robot. Congratulations!

During the process, you learned some basic concepts of the Robot Framework and some good practices:

  • Robot files (simple-robot.robot)
  • Robot file sections (*** Tasks ***)
  • Naming tasks (Greet)
  • Robot keywords (Log To Console)
  • Robot Framework conventions (indentation, spacing)
  • Creating an executable package (robo wrap)
  • Running robot files (robo run, robo run entrypoint.cmd)
  • Report and log files (log.html, report.html)
  • Organizing your project files in subdirectories (robo init simple-robot)

You can find more information in the Robot Framework User Guide.