0% found this document useful (0 votes)
41 views

Robot_Framework_Notes

Uploaded by

suguj64
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

Robot_Framework_Notes

Uploaded by

suguj64
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Robot Framework Notes

Introduction to Robot Framework

Robot Framework is an open-source, keyword-driven test automation framework used


primarily for acceptance testing, acceptance test-driven development (ATDD), and robotic
process automation (RPA). It allows testers and developers to write test cases in plain text
using a tabular format, which makes the tests easy to understand and maintain.

The framework is highly extensible and supports integration with various tools and
libraries, such as SeleniumLibrary for web UI testing, DatabaseLibrary for database testing,
and AppiumLibrary for mobile testing. It is platform-independent, supporting Windows,
macOS, and Linux.

Key Features of Robot Framework

- Keyword-driven Testing: Tests are written in a human-readable format using keywords,


promoting readability and collaboration.
- Library Support: Includes built-in libraries and supports third-party integrations for
specialized tasks.
- Extensibility: Users can create custom keywords and libraries in Python or Java.
- Data-driven Testing: Supports running the same test case with multiple input values.
- Rich Reporting: Automatically generates detailed logs and reports for test execution.

Advantages of Robot Framework

1. Easy to Learn and Use: The tabular format and plain text test cases make it accessible to
non-programmers.
2. Extensible with Libraries: Integration with libraries like SeleniumLibrary expands its
capabilities.
3. Cross-platform Support: Runs on Windows, macOS, and Linux, ensuring compatibility
across environments.
4. Keyword Reusability: Promotes modularity, allowing reusable components across
multiple test cases.
5. Data-driven Testing: Built-in support for passing multiple data sets to a single test case.
6. Detailed Reporting and Logging: Generates easy-to-understand HTML reports and logs
with execution details.
7. Community Support: A large and active community provides extensive resources, plugins,
and tools.
8. Integration with CI/CD Pipelines: Seamless integration ensures continuous testing and
delivery.
9. Open-source and Free: No licensing cost makes it an excellent choice for organizations of
all sizes.

Robot Framework Keywords

Keywords are reusable actions in Robot Framework that represent a specific task or
functionality. They can be built-in, custom-defined, or imported from external libraries.

Types of Keywords:
1. Built-in Keywords: Provided by Robot Framework, e.g., `Log`, `Run Keyword If`.
2. Library Keywords: Provided by external libraries, e.g., `Click Button` from
SeleniumLibrary.
3. User-defined Keywords: Created by users for reusability and readability.

Synchronization in Robot Framework

Synchronization ensures that the automation script waits for the web elements to become
available before interacting with them.

Common Synchronization Keywords:


1. Sleep: Pauses execution for a fixed duration.
2. Wait Until Element Is Visible: Waits for an element to be visible.
3. Wait Until Page Contains: Waits until the page contains specific text.

Error Message Validation

Error message validation ensures that the application displays the correct error messages
during invalid scenarios. Example:

*** Test Cases ***


Verify Error Message
Input Text username invalid_user
Input Text password wrong_password
Click Button login
Element Should Contain id=error_message Invalid username or password

Declare Variables and Use Globally

Variables in Robot Framework store data that can be reused across the test suite.
Defining Variables:
*** Variables ***
${BASE_URL} https://example.com
${USERNAME} admin
${PASSWORD} admin123

Importance of Resource File

A resource file is used to store common keywords, variables, and settings that can be reused
across multiple test cases.

Advantages:
1. Promotes reusability and modularity.
2. Simplifies test case maintenance.
3. Reduces duplication of code.

Using Resource File Example:


*** Settings ***
Resource common_resources.robot

*** Test Cases ***


Open App Test
Open Application

How to Send Arguments to Keywords

Define the keyword to accept arguments:


*** Keywords ***
Login To Application
[Arguments] ${username} ${password}
Input Text username ${username}
Input Text password ${password}
Click Button login

You might also like