VST

Robot Framework

Listeners: Key to Robot Framework Power

Introduction:

  1. Listeners in Robot Framework are indeed Python classes that allow developers to interact with the test execution process at various stages.
  2. These listeners serve as hooks or callbacks that trigger specific actions or behaviors during different phases of test execution.
  3. They enable users to gather information, manipulate the execution flow, or perform custom actions based on events occurring during test runs.

Dependency required:

There are no explicit dependencies required for the implementation of listeners. Instead, we can access and use Robot Framework’s built-in keywords and variables by importing the BuiltIn library from robot.libraries.BuiltIn.

Listener interface versions:

There are two supported listener interface versions.

  1. A listener must have an attribute ROBOT_LISTENER_API_VERSION with value 2 or 3.
  2. Listener versions 2 and 3 have mostly the same methods, but some methods are not available in version 3.
  3. As per requirement/pre-condition method can be called such as start_keyword, end_keyword, message, library_import, resource_import, and variables_import.

As per Robot documentation below methods are available:

Methods

Listener Implementation:

  • Imports Robot – BuiltIn lib
IMG_1
  • Class and constructor
IMG_2
  • Get project root path
IMG_3
  • Python Configuration file for listeners
IMG_4
  • Mapping of Robot keywords
IMG_5
  • Start suite
IMG_6
  • Start Test
IMG_7
  • End Test
IMG_8
  • End Suite
IMG_9

Test Execution:

Execute test suite using this command

robot --listener listenerFilePath TestFileName.robot

Test Execution Report:

Attaching execution reports for reference:

Report_1
Report_2
Report_3
Report_4
Tags:
Robot Framework

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

Test Automation Streamlining REST API Processes with Postman Automation Summary:In today's world, industries are increasingly focusing on the development of...

Uncategorized Enhancing Test Efficiency with Playwright, TestNG and Allure Summary:Playwright is an open-source library developed by Microsoft for automated browser...

Test Automation Continuous Integration and Delivery with Jenkins and GitHub Summary: Testing and deployment-related operations can be automated with Jenkins,...

Mobile App Test Automation with TDD Telecommunications (Cable) Location Performance Testing CONTEXT Elyments is an India-based mobile application similar to...

Leave a Reply

Your email address will not be published. Required fields are marked *