The Robot Framework language

Lobsters Hottest Tools

Summary

This article is a guide to writing code using Robot Framework, covering basic syntax, file structure, and indentation rules for automation testing and RPA tasks.

<p><a href="https://lobste.rs/s/e1pwba/robot_framework_language">Comments</a></p>
Original Article
View Cached Full Text

Cached at: 09/01/26, 11:46 AM

# Writing Your First Code | ROBOT FRAMEWORK Source: [https://docs.robotframework.org/docs/getting_started/how_to_write_rf](https://docs.robotframework.org/docs/getting_started/how_to_write_rf) Robot Framework is a versatile and powerful automation framework that uses plain text syntax\. It is designed to be easy to read and write, making it accessible to both technical and non\-technical users\. In this guide, we’ll cover the basics of Robot Framework syntax to get you started\. note In this guide, we will primarily focus on testing, specifically Test Cases and Test Suites\. The same principles also apply when discussing RPA Tasks\. ## File name[​](https://docs.robotframework.org/docs/getting_started/how_to_write_rf#file-name) You can name your files anything you like, as long as they have the \.robot extension\. For example: 'MyFirstTest\.robot'\. ## Sections[​](https://docs.robotframework.org/docs/getting_started/how_to_write_rf#sections) A Robot Framework test suite consists of multiple test cases organized within a single file\. The basic structure of a test suite file includes the following sections: 1. Settings 2. Test Cases Although there are additional sections available, the Test Cases section is mandatory for running a test\. ### Settings[​](https://docs.robotframework.org/docs/getting_started/how_to_write_rf#settings) The Settings section is where you define the libraries, resource files, and other settings needed for your test suite\. ``` *** Settings ***Library String ``` The libraries contain the keywords \(functions/steps\) that Robot Framework uses to execute tests\. Each library includes documentation of the keywords it provides\. To use these, importing the library is necessary\. ### Test Cases or Tasks[​](https://docs.robotframework.org/docs/getting_started/how_to_write_rf#test-cases-or-tasks) The Test Cases or Tasks section is where you define your individual test cases\. Each test case/task is a sequence of keywords\. These keywords determine the steps or actions that your test or task performs\. There is no limit to the number of steps a testcase can have, but there are good practices and it is good to create conventions with your co\-workers to ensure readability\. - Tests - Tasks ``` *** Test Cases ***Create A Random String Log To Console We are going to generate a random string Generate Random String 10 Log To Console We finished generating a random string ``` ## Indentation[​](https://docs.robotframework.org/docs/getting_started/how_to_write_rf#indentation) In the provided examples, you can see that Robot Framework code is separated by spaces\. To correctly differentiate elements, Robot Framework requires at least two spaces\. Here are a few examples based on the code we've seen so far: ``` *** Settings ***Library String ``` - The`Library`keyword in the Settings section is unindented\. This indicates that`Library`is the setting being declared\. - Between`Library`and`String`, there are several spaces\. This indicates that`String`is the name of the library needed for our tests\. ``` *** Test Cases ***Create A Random String Log To Console We are going to generate a random string Generate Random String 10 Log To Console We finished generating a random string ``` - `Create A Random String`in the Test Cases section is unindented, indicating that it is a test case name\. - The lines below`Create A Random String`are indented, showing that these are keywords used in the test case\. - Several spaces between`Generate Random String`and`10`indicate that`10`is an argument for the keyword, specifying that our random string will be 10 characters long\. - The`Log To Console`keywords are followed by a few spaces and a sentence\. The spaces ensure that the following sentence is the text we want to log to our console\. You can see that spacing and indentation are extremely important in Robot Framework\. They are necessary to distinguish between a keyword and its arguments, as well as to differentiate between test names and the keywords within the tests\. Remember, Robot Framework needs at least two spaces to correctly differentiate elements\. More spaces are also allowed\. For more details on spacing conventions, refer to the[Style Guide](https://docs.robotframework.org/docs/style_guide#horizontal-spacing)\. ## Everything together[​](https://docs.robotframework.org/docs/getting_started/how_to_write_rf#everything-together)

Similar Articles

RoboLab: A High-Fidelity Simulation Benchmark for Analysis of Task Generalist Policies

Hugging Face Daily Papers

RoboLab is a high-fidelity simulation benchmarking framework for evaluating task-generalist robotic policies, introducing the RoboLab-120 benchmark with 120 tasks across visual, procedural, and relational competency axes. It enables scalable, realistic task generation and systematic analysis of policy behavior under controlled perturbations to assess true generalization capabilities.

RobotUse: Allocating Computation, Context, and Decisions

Hugging Face Daily Papers

RobotUse 引入一种围绕指定与修订物理动作来组织计算、上下文与决策的机器人智能体 harness,使智能体通过视觉选择目标与位姿、后端处理几何与运动规划,并在执行中持续学习,最终在 RoboLab 上取得 45% 的任务成功率,超过 CaP-X 6.7 个百分点。

Robot comment classifier

Lobsters Hottest

The article describes a tool that distinguishes AI-generated comments from human-written ones in code using linguistic features like character frequency, and discusses its methodology and implications.