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:

Listener Implementation:

  • Imports Robot – BuiltIn lib
         
  • Class and constructor
         
  • Get project root path
         
  • Python Configuration file for listeners
         
  • Mapping of Robot keywords
       
  • Start suite
       
  • Start Test
       
  • End Test
       
  • End Suite
       

Test Execution:

Execute test suite using this command

robot --listener listenerFilePath TestFileName.robot

Test Execution Report:

Attaching execution reports for reference:

Tags:
Robot Framework
Share:

Linkedin


Twitter


Youtube

Related Post


edit post


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

Read More


edit post


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

Read More


edit post


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

Read More


edit post


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

Read More