What is the default test case file format in Robot Framework?

Robot Framework's default test case file format is plain text, using a tabular structure. This means you organize your test data (test cases, keywords, variables, etc.) in tables within text files.

Here's a simple example of what a Robot Framework test case file might look like :

***Settings***
Library    SeleniumLibrary

***Variables***
${BROWSER}    chrome
${URL}        https://www.example.com

***Test Cases***
Open Browser and Navigate to Website
    Open Browser    ${URL}    ${BROWSER}
    Maximize Browser Window
    Title Should Be    Example Domain

***Keywords***
Open Browser and Navigate to Website
    [Arguments]    ${url}    ${browser}
    Open Browser    ${url}    ${browser}
    Maximize Browser Window


Key aspects of the format:

  • Sections: The file is divided into sections, such as ***Settings***, ***Variables***, ***Test Cases***, and ***Keywords***, to organize different types of data.
  • Tables: Within each section, data is organized in tables using spaces or pipes as separators.
  • Keywords: Robot Framework uses keywords to represent actions or steps in your tests. You can use built-in keywords, keywords from libraries (like SeleniumLibrary), or create your own user-defined keywords.

Why this format?

  • Readability: The tabular format makes it relatively easy to read and understand test cases, even for non-programmers.
  • Simplicity: Plain text files are simple to create and edit with any text editor.
  • Maintainability: The structured format makes it easier to maintain and update test cases.

While plain text with a tabular structure is the default and most common format, Robot Framework also supports other formats like:

  • HTML
  • TSV (Tab Separated Values)
  • reStructuredText
  • JSON

However, the plain text format remains the most widely used due to its simplicity and readability.