Module sysbot.utils.robot.listener.mongodb

MongoDB Listener for Robot Framework BDD Database Integration

This module provides a Robot Framework listener that stores test results in MongoDB.

Usage

robot –listener sysbot.utils.robot.listener.mongodb.Mongodb:mongodb://localhost:27017/testdb:MyCampaign your_tests/

Example

robot –listener sysbot.utils.robot.listener.mongodb.Mongodb:mongodb://localhost:27017/test_results:Sprint42 your_tests/

Requirements

  • pymongo package must be installed
  • MongoDB server must be running and accessible

Classes

class Mongodb (connection_string: str, campaign_name: str = 'Default Campaign')

Robot Framework listener that stores test results in MongoDB database.

MongoDB is a NoSQL document database suitable for flexible schema requirements and high-volume test result storage.

The listener creates a hierarchical structure: - Test Campaign (top level) - Test Suite - Test Case - Keyword

Requires: pymongo Install with: pip install pymongo

Initialize MongoDB listener.

Args

connection_string
MongoDB connection string (e.g., mongodb://host:port/database)
campaign_name
Name of the test campaign

Raises

ImportError
If pymongo is not installed

Class variables

var ROBOT_LISTENER_API_VERSION

Methods

def close(self)

Close database connection and update campaign end time.

Updates the campaign end timestamp and closes the MongoDB connection.

def end_keyword(self, data, result)

Called when a keyword ends.

Args

data
Robot Framework keyword data object.
result
Robot Framework keyword result object.
def end_suite(self, data, result)

Called when a test suite ends.

Args

data
Robot Framework suite data object.
result
Robot Framework suite result object.
def end_test(self, data, result)

Called when a test case ends.

Args

data
Robot Framework test data object.
result
Robot Framework test result object.
def start_keyword(self, data, result)

Called when a keyword starts.

Args

data
Robot Framework keyword data object.
result
Robot Framework keyword result object.
def start_suite(self, data, result)

Called when a test suite starts.

Args

data
Robot Framework suite data object.
result
Robot Framework suite result object.
def start_test(self, data, result)

Called when a test case starts.

Args

data
Robot Framework test data object.
result
Robot Framework test result object.