Robot Framework Hello World Example
Robot Framework Hello World Example
Robot Framework is a generic, open‑source test automation framework designed primarily for acceptance testing and acceptance test‑driven development (ATDD). It uses a keyword‑driven approach, which means that tests are written using a tabular syntax that makes them both readable and maintainable—even for those with minimal programming experience.
A simple Robot Framework test consists of creating a .robot file and using simple keywords to describe the actions you want to perform.
Create a test file
Create a test file, for example: hello_test.robot
The default file extension for Robot Framework test files are saved with .robot file extension. Although plain text or .txt files can also be used.
*** Settings ***
Library String
*** Test Cases ***
Hello World Test
${message}= Convert To Upper Case hello, world!
Log ${message}
In this example:
Settings section: Specifies the libraries or resources the test will use (in this case, the String library).
Test Cases section: Contains the actual test logic. You define test cases, each consisting of a series of keywords.
Run the Test
To run the test, use this command:
/> robot hello_test.robot
View the report.html Test report file.
That’s it. You have successfully ran a test using Robot Framework.